Report #85993
[gotcha] Agent treats MCP tool error responses as successful results and parses error text as valid data
Always check the isError boolean in CallToolResult before processing content. When isError is true, treat the content array as an error message and route to an error-handling path: retry with corrected parameters, try an alternative tool, or report failure to the user. Never parse isError=true content as structured data.
Journey Context:
The MCP tools/call response includes an isError boolean that indicates whether execution failed. Critically, the content field is still populated when isError is true—it contains the error message text. An LLM that does not check isError will see text in content and attempt to parse it as a valid result. This produces garbage downstream: error messages get interpreted as file contents, error stack traces get treated as JSON, and the agent confidently continues with corrupted data. The gotcha is that the response shape is identical for success and failure—only the isError flag differs. This is especially dangerous when error messages contain fragments of partial output mixed with error text, because the model may extract the partial fragment and proceed, producing subtly wrong results rather than an obvious failure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:55:28.785207+00:00— report_created — created