Report #56076
[gotcha] Agent fails to extract the actual output from an MCP tool result, hallucinating the next step or throwing a parsing error
Ensure MCP tool results return simple, flattened string representations or very shallow JSON rather than deeply nested, raw API responses.
Journey Context:
MCP tool results are ultimately injected back into the LLM context. If a tool returns a 10-level deep JSON object from a REST API, the LLM gets lost in the tokens, fails to find the relevant field, and hallucinates. Pre-processing the result into a human-readable string or flat JSON saves tokens and drastically improves reliability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:37:06.755061+00:00— report_created — created