(toolConfig: ToolConfig)
| 685 | * Creates a complete tool schema for execution with all parameters |
| 686 | */ |
| 687 | export function createExecutionToolSchema(toolConfig: ToolConfig): ToolSchema { |
| 688 | const schema: ToolSchema = { |
| 689 | type: 'object', |
| 690 | properties: {}, |
| 691 | required: [], |
| 692 | } |
| 693 | |
| 694 | Object.entries(toolConfig.params).forEach(([paramId, param]) => { |
| 695 | const propertySchema: any = { |
| 696 | type: param.type === 'json' ? 'object' : param.type, |
| 697 | description: param.description || '', |
| 698 | } |
| 699 | |
| 700 | // Include items property for arrays |
| 701 | if (param.type === 'array' && param.items) { |
| 702 | propertySchema.items = { |
| 703 | ...param.items, |
| 704 | ...(param.items.properties && { |
| 705 | properties: { ...param.items.properties }, |
| 706 | }), |
| 707 | } |
| 708 | } else if (param.items) { |
| 709 | logger.warn( |
| 710 | `items property ignored for non-array param "${paramId}" in tool "${toolConfig.id}"` |
| 711 | ) |
| 712 | } |
| 713 | |
| 714 | schema.properties[paramId] = propertySchema |
| 715 | |
| 716 | if (param.required) { |
| 717 | schema.required.push(paramId) |
| 718 | } |
| 719 | }) |
| 720 | |
| 721 | return schema |
| 722 | } |
| 723 | |
| 724 | /** |
| 725 | * Deep merges inputMapping objects, where LLM values fill in empty/missing user values. |
no test coverage detected