MCPcopy Create free account
hub / github.com/coder/coder / inputItems

Method inputItems

aibridge/intercept/responses/reqpayload.go:215–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

213}
214
215func (p RequestPayload) inputItems() ([]any, error) {
216 input := gjson.GetBytes(p, reqPathInput)
217 if !input.Exists() || input.Type == gjson.Null {
218 return []any{}, nil
219 }
220
221 if input.Type == gjson.String {
222 return []any{responses.ResponseInputItemParamOfMessage(input.String(), responses.EasyInputMessageRoleUser)}, nil
223 }
224
225 if !input.IsArray() {
226 return nil, xerrors.Errorf("unsupported 'input' type: %s", input.Type)
227 }
228
229 items := input.Array()
230 existing := make([]any, 0, len(items))
231 for _, item := range items {
232 existing = append(existing, json.RawMessage(item.Raw))
233 }
234
235 return existing, nil
236}
237
238func (p RequestPayload) toolItems() ([]json.RawMessage, error) {
239 tools := gjson.GetBytes(p, reqPathTools)

Callers 1

appendInputItemsMethod · 0.95

Calls 3

ExistsMethod · 0.45
StringMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected