Преглед на файлове

fix(opencode): expose structured MCP output (#32074)

Aiden Cline преди 2 месеца
родител
ревизия
be227503af
променени са 1 файла, в които са добавени 9 реда и са изтрити 3 реда
  1. 9 3
      packages/opencode/src/mcp/catalog.ts

+ 9 - 3
packages/opencode/src/mcp/catalog.ts

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