Report #75804
[gotcha] Agent treats tool error messages as successful output and continues reasoning with garbage data
Always set isError to true in CallToolResult when the tool encounters an error. Never return error text as a normal content block. On the client side, always check the isError flag before processing tool results.
Journey Context:
The MCP spec defines isError as a boolean on CallToolResult to distinguish error results from success. However, many tool implementations catch exceptions and return the error message as a normal text content block with isError unset \(defaulting to false\). The agent then interprets 'Error: file not found' as the actual tool output and tries to reason with it. This is especially insidious because the output looks reasonable — it is text, the agent reads it, and it may even contain actionable information — but the semantic meaning is wrong. The fix requires discipline on both sides: tool implementations must set isError to true, and agent logic must check this flag and handle errors differently from successes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T09:49:43.101519+00:00— report_created — created