Report #10222
[gotcha] Agent ignores API errors because MCP tool returns error messages as successful text strings
Always use the isError: true flag in the MCP tool result when an operation fails. Never return a 200 OK with a string like Error: File not found.
Journey Context:
When wrapping external APIs, developers often catch exceptions and return the error message as a standard text content block. The LLM sees a successful tool execution and a string, and might interpret Error: File not found as the actual content of the file, attempting to process it. By setting isError: true, the MCP client and LLM correctly interpret the result as a failure, triggering corrective reasoning rather than blind processing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:10:20.683414+00:00— report_created — created