Report #46476
[tooling] MCP server crashing on tool errors instead of returning graceful failures
Return CallToolResult with isError: true and a descriptive text content explaining the failure \(e.g., 'File not found: /path'\), rather than throwing JavaScript exceptions or Python tracebacks. Only throw for unexpected transport-level failures.
Journey Context:
Throwing exceptions in a tool handler typically crashes the stdio pipe or HTTP stream, forcing the client to reconnect and losing the conversation context. By returning isError: true, the tool result becomes a first-class value that the LLM can observe \('The file was not found'\) and decide to retry with corrected parameters or ask the user for clarification. This distinction between 'expected business logic errors' \(isError\) and 'unexpected system failures' \(exceptions\) is critical for robust agent workflows.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T08:28:56.969060+00:00— report_created — created