|
@@ -50,8 +50,8 @@ export function convertTool(mcpTool: MCPToolDef, client: Client, timeout?: numbe
|
|
|
return dynamicTool({
|
|
return dynamicTool({
|
|
|
description: mcpTool.description ?? "",
|
|
description: mcpTool.description ?? "",
|
|
|
inputSchema: jsonSchema(inputSchema),
|
|
inputSchema: jsonSchema(inputSchema),
|
|
|
- execute: (args: unknown, options) =>
|
|
|
|
|
- client.callTool(
|
|
|
|
|
|
|
+ execute: async (args: unknown, options) => {
|
|
|
|
|
+ const result = await client.callTool(
|
|
|
{
|
|
{
|
|
|
name: mcpTool.name,
|
|
name: mcpTool.name,
|
|
|
arguments: (args || {}) as Record<string, unknown>,
|
|
arguments: (args || {}) as Record<string, unknown>,
|
|
@@ -62,7 +62,13 @@ export function convertTool(mcpTool: MCPToolDef, client: Client, timeout?: numbe
|
|
|
signal: options.abortSignal,
|
|
signal: options.abortSignal,
|
|
|
timeout,
|
|
timeout,
|
|
|
},
|
|
},
|
|
|
- ),
|
|
|
|
|
|
|
+ )
|
|
|
|
|
+ if (result.structuredContent === undefined || result.structuredContent === null) return result
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...result,
|
|
|
|
|
+ content: [{ type: "text" as const, text: JSON.stringify(result.structuredContent) }],
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|