| 95 | } |
| 96 | |
| 97 | function makeTool(opts: { |
| 98 | cliName: string; |
| 99 | mcpName?: string; |
| 100 | id?: string; |
| 101 | nextStepTemplates?: ToolDefinition['nextStepTemplates']; |
| 102 | workflow: string; |
| 103 | stateful: boolean; |
| 104 | handler: ToolDefinition['handler']; |
| 105 | xcodeIdeRemoteToolName?: string; |
| 106 | }): ToolDefinition { |
| 107 | return { |
| 108 | id: opts.id, |
| 109 | cliName: opts.cliName, |
| 110 | mcpName: opts.mcpName ?? opts.cliName.replace(/-/g, '_'), |
| 111 | nextStepTemplates: opts.nextStepTemplates, |
| 112 | workflow: opts.workflow, |
| 113 | description: `${opts.cliName} tool`, |
| 114 | mcpSchema: { value: z.string().optional() }, |
| 115 | cliSchema: { value: z.string().optional() }, |
| 116 | stateful: opts.stateful, |
| 117 | xcodeIdeRemoteToolName: opts.xcodeIdeRemoteToolName, |
| 118 | handler: opts.handler, |
| 119 | }; |
| 120 | } |
| 121 | |
| 122 | function invokeAndFinalize( |
| 123 | invoker: DefaultToolInvoker, |