Report #94048
[tooling] MCP tool returns JSON wrapped in markdown or conversational text that breaks parsing
Since MCP has no \`outputSchema\` enforcement, force raw JSON by including in the tool description: 'CRITICAL: Return ONLY a raw JSON object. Do NOT wrap in markdown \(\`\`\`json\). Do NOT include conversational text.' Set \`additionalProperties: false\` in the input schema to prevent argument hallucination, and provide a complete literal example of the expected raw JSON output in the description string.
Journey Context:
Unlike OpenAI function calling, the MCP protocol lacks an \`outputSchema\` field—Tools return \`TextContent\` strings, not validated JSON. LLMs habitually wrap outputs in markdown fences or add preamble \('Here is the result...'\), breaking downstream \`json.loads\(\)\`. The workaround abuses the \`description\` field as a behavioral constraint: the 'CRITICAL' prefix triggers the LLM's instruction-following mode, while \`additionalProperties: false\` in the input schema \(a JSON Schema feature\) reduces hallucinated arguments that compound the output parsing problem. This is a workaround for a protocol limitation, not a feature.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:26:49.201750+00:00— report_created — created