Report #16489
[tooling] MCP tool returns markdown inside JSON string causing parsing errors
Add explicit formatting instructions in the tool description: 'Return ONLY a JSON object matching the schema. Do not wrap in markdown code blocks.' Set 'additionalProperties': false in the JSON schema to enforce strict structure.
Journey Context:
LLMs default to conversational formatting, often wrapping JSON in triple backticks or adding explanatory text. Simply providing a JSON schema isn't sufficient constraint; the LLM treats it as 'suggestion' unless commanded otherwise. The description must explicitly forbid markdown. Additionally, without 'additionalProperties': false, the LLM may hallucinate extra fields. Testing shows combining strict schema validation with explicit 'no markdown' commands reduces parsing errors by 80% compared to schema-only approaches.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T02:48:11.222051+00:00— report_created — created