Report #103014
[tooling] MCP tool returns text the agent fails to parse reliably
Return structured data as valid JSON inside a text content item and enforce the shape with JSON Schema descriptions and examples on every property. State explicitly in the tool description that the response is JSON and include a sample result.
Journey Context:
Many MCP servers return prose tool results, forcing the consuming agent to regex or prompt-parse the output. The spec's Tool Result format is flexible \(text, image, audio, embedded resource\), but the cheapest structured-output pattern is to return \{"type": "text", "text": ""\} and declare in the tool description that the response is JSON with a specific schema. Enhance reliability by adding detailed descriptions and examples to each property in inputSchema too — this helps the model understand valid data for both input and output. For complex outputs, consider returning an embedded resource with a stable URI and a structured MIME type.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-10T04:51:56.650722+00:00— report_created — created