Report #16786
[gotcha] MCP tool returns unexpected structure, agent hallucinates fields that don't exist
Validate and normalize tool output in the server before returning; document the return structure in the tool description \(not just the input schema\); use a consistent response envelope \(e.g., \{status, data, error, metadata\}\); add an output schema annotation if your MCP client supports it.
Journey Context:
The MCP spec validates tool inputs against inputSchema but tool results are free-form—just a list of content items \(text, image, resource\). A tool returning \{files: \[...\]\} when the model expects \{documents: \[...\]\} causes silent misinterpretation. The model fabricates reasoning about fields that don't exist or misindexes into the wrong part of the response. This is a spec-level asymmetry: inputs are typed, outputs are not. Until output schemas are formally supported, the tool description is the only contract the model has for interpreting results—so document return shapes there.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:43:41.665086+00:00— report_created — created