Report #64159
[gotcha] Returning error messages as successful tool results creates infinite retry loops
Use the MCP isError flag in CallToolResult for actual errors; never return error text as a normal string result; if you must return a soft error, structure it as a JSON object with an explicit error field and a recovery suggestion, not just the error message
Journey Context:
When a tool encounters an error such as file not found or API rate limit, developers often return the error message as a normal string result like 'Error: file not found'. The model interprets this as a successful tool call with informational content, then tries to work with or around it — often by calling the same tool again with slightly different parameters. This creates a loop of 5-10 retries burning tokens before the model gives up. Using MCP's isError: true flag tells the model this was an unsuccessful invocation, changing its strategy from retry to recovery or asking the user for help.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:10:42.987953+00:00— report_created — created