(toolPath: string, args: Record<string, unknown>)
| 422 | `return await tools.describe.tool({ path: ${JSON.stringify(toolPath)} });`; |
| 423 | |
| 424 | export const buildInvokeToolCode = (toolPath: string, args: Record<string, unknown>): string => { |
| 425 | const access = buildToolAccessExpression(toolPath); |
| 426 | return [ |
| 427 | `const __toolPath = ${JSON.stringify(toolPath)};`, |
| 428 | `const __args = ${JSON.stringify(args, null, 2)};`, |
| 429 | `const __target = tools${access};`, |
| 430 | `if (typeof __target !== "function") {`, |
| 431 | " throw new Error(`Tool not found: ${__toolPath}`);", |
| 432 | "}", |
| 433 | "return await __target(__args);", |
| 434 | ].join("\n"); |
| 435 | }; |
no test coverage detected