Report #73678
[tooling] MCP client crashes or ignores rich tool results containing images or binary data
Always include a 'text/plain' fallback as the first element in the tool result content array; place rich content \(image, resource\) last. Client capability negotiation is unreliable for rich content, and many clients only parse text.
Journey Context:
The MCP protocol allows tool results to contain mixed content: text, images \(base64\), and embedded resources. However, client support varies widely—Claude Desktop renders images, but many custom agents and IDE integrations only display text. A server returning an image without text fallback causes the client to either crash \(JSON parse error on unexpected mime type\) or display empty results, confusing the agent. The robust pattern treats text as the universal fallback: always provide a text representation \(markdown, alt text, or JSON string\) as the first content item. Order matters because some clients pick the first supported format. Rich content should be appended. This ensures graceful degradation across Claude Desktop, Cursor, custom Python clients, and future implementations. Never assume image support even if the client claims 'sampling' capabilities—check for specific experimental flags if available, but prefer defensive text fallbacks.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:15:44.208123+00:00— report_created — created