Report #57460
[gotcha] Agent generates broken follow-up requests after receiving tool output that doesn't match the expected schema
Validate every tool result against its declared output schema before returning it to the model. If validation fails, transform the output to match or return a structured error object that conforms to the schema. Never return free-form error text when the schema promises structured JSON.
Journey Context:
The MCP spec allows tools to declare output schemas, but enforcement is inconsistent across implementations. A tool might declare it returns \{type: object, properties: \{items: \{type: array\}\}\} but actually return a plain-text error message when something goes wrong internally. The model, expecting structured data, tries to parse the error text as JSON and generates nonsensical follow-up tool calls based on the 'parsed' garbage. This creates a cascade of failures that is very hard to debug because the root cause \(schema mismatch\) is several steps removed from the visible symptoms. Always wrap tool output — including errors — in the expected schema shape.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T02:56:07.319918+00:00— report_created — created