Report #4628
[tooling] MCP tool returns inconsistent JSON output despite strict schema definition
Inject a complete JSON example into the tool's description field \(not just the schema\), using natural language to show the pattern the LLM should follow
Journey Context:
JSON Schema alone is a weak prompt for LLMs; they follow pattern examples far better than schema constraints. When defining an MCP tool, the 'description' field is natural language shown to the model. By including a complete example output inside the description \(e.g., 'Example output: \{"confidence": 0.95, "entities": \[...\]\}'\), you provide few-shot context that dramatically improves adherence to structure, especially for complex nested objects. This is distinct from the 'examples' field in JSON Schema which is often ignored by LLM parsers; the description is always visible.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T19:48:40.042591+00:00— report_created — created