(param: ToolParamDefinition)
| 461 | } |
| 462 | |
| 463 | function 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 | |
| 503 | export function createUserToolSchema( |
| 504 | toolConfig: ToolConfig, |
no outgoing calls
no test coverage detected