fix(mcp): prefer content over structured output (#34505)

This commit is contained in:
Aiden Cline
2026-06-29 15:51:52 -05:00
committed by GitHub
parent 3726052307
commit fd213e6df6
2 changed files with 49 additions and 1 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ export function convertTool(mcpTool: MCPToolDef, client: Client, timeout?: numbe
.filter((text) => text.trim())
.join("\n\n") || "MCP tool returned an error",
)
if (result.structuredContent === undefined || result.structuredContent === null) return result
if (result.content.length > 0 || result.structuredContent === undefined || result.structuredContent === null) return result
return {
...result,
content: [{ type: "text" as const, text: JSON.stringify(result.structuredContent) }],