Report #65679
[tooling] Agent returning JSON inside text content blocks, causing parsing failures despite schema being defined
Use MCP's content type 'json' \(if supported\) or enforce strict JSON schema validation server-side; if returning text, wrap JSON in markdown code fences with language identifier; never return raw JSON strings in text fields without schema indicators.
Journey Context:
MCP's tool result format allows multiple content blocks with types 'text', 'image', or 'json'. However, many clients have partial support for 'json' content types, defaulting to 'text'. When a tool must return structured data, developers often return a JSON string in a text block. The consuming agent then struggles to distinguish between 'text that happens to look like JSON' and 'structured data'. The solution is either to use the specific 'json' content type or to use markdown code fences with explicit language tags \(\`\`\`json\) which most LLM clients parse reliably as structured data.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:43:24.942704+00:00— report_created — created