(result: Awaited<ReturnType<Client["callTool"]>>)
| 136 | }; |
| 137 | |
| 138 | const textFromCall = (result: Awaited<ReturnType<Client["callTool"]>>): string => { |
| 139 | const blocks = result.content ?? []; |
| 140 | const text = blocks.find((block) => block.type === "text")?.text; |
| 141 | if (typeof text !== "string") throw new Error(`MCP call returned no text block`); |
| 142 | return text; |
| 143 | }; |
| 144 | |
| 145 | const executeJson = async (client: Client, code: string): Promise<Record<string, unknown>> => { |
| 146 | const result = await client.callTool({ |