MCPcopy Index your code
hub / github.com/simstudioai/sim / buildCopilotFileParameterSchema

Function buildCopilotFileParameterSchema

apps/sim/tools/params.ts:463–501  ·  view source on GitHub ↗
(param: ToolParamDefinition)

Source from the content-addressed store, hash-verified

461}
462
463function buildCopilotFileParameterSchema(param: ToolParamDefinition): SchemaProperty {
464 const baseDescription =
465 param.description ||
466 (param.type === 'file'
467 ? 'A file object for tool execution.'
468 : 'An array of file objects for tool execution.')
469 const resolutionDescription =
470 'For copilot and mothership tool calls, prefer passing canonical workspace file IDs such as "wf_123". The runtime will resolve them into full file objects before tool execution.'
471
472 const fileObjectSchema: SchemaProperty = {
473 type: 'object',
474 description: `${baseDescription} ${resolutionDescription}`,
475 properties: {
476 id: { type: 'string', description: 'Canonical workspace file ID.' },
477 name: { type: 'string', description: 'File name.' },
478 url: { type: 'string', description: 'File URL or serve path.' },
479 size: { type: 'number', description: 'File size in bytes.' },
480 type: { type: 'string', description: 'MIME type.' },
481 key: { type: 'string', description: 'Internal storage key.' },
482 context: { type: 'string', description: 'Optional file context.' },
483 base64: { type: 'string', description: 'Optional base64-encoded file contents.' },
484 },
485 required: ['id', 'name', 'url', 'size', 'type', 'key'],
486 }
487
488 if (param.type === 'file') {
489 return fileObjectSchema
490 }
491
492 return {
493 type: 'array',
494 description: `${baseDescription} ${resolutionDescription}`,
495 items: {
496 type: 'object',
497 description: 'A file object.',
498 properties: fileObjectSchema.properties,
499 },
500 }
501}
502
503export function createUserToolSchema(
504 toolConfig: ToolConfig,

Callers 1

buildParameterSchemaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected