Report #56405
[tooling] Agent hallucinating tool output schema or failing to parse because MCP lacks outputSchema field
Document JSON output schema in tool.description and return stringified JSON in text content; do not rely on non-existent outputSchema
Journey Context:
MCP's Tool definition only has inputSchema; there is no outputSchema field \(unlike OpenAPI\). If you return plain text, the LLM must guess the format. The robust pattern is: \(1\) In the tool description, explicitly state: 'Returns JSON object with keys: result \(string\), count \(int\)', \(2\) In the tool implementation, return Content with type 'text' containing a JSON.stringify\(\) of your object. Some clients support content type 'json', but text is universal. This prevents the agent from hallucinating missing keys or expecting XML instead of JSON.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:10:11.925899+00:00— report_created — created