Your MCP tool just failed. How does the server tell the model what went wrong?
Tool error: successful response with `isError: true` plus content the model reads. Protocol error: JSON-RPC error object with numeric code; the host catches it and the model never sees it.
Imagine ordering food at a restaurant. Two ways things can go wrong. First: the kitchen tried to cook your dish but ran out of an ingredient. The waiter brings you a polite note explaining and asks if you want something else. That is a tool error. The tool ran, but the result was a failure. You (the model) read the note and decide what to do next. Second: the waiter does not understand what you said because you spoke a language they do not know. The conversation broke down before anyone could try cooking. That is a protocol error. The system failed before the operation even started. MCP uses different channels for each: a flag inside a normal response for the first kind, a numbered error code for the second.
Detailed answer & concept explanation~5 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: walk both error channels with one example each, state the decision test (can the model act on it?), name the standard JSON-RPC codes, describe the most common bug (mixing channels), and close with the host-side convention of reformulating -32602 as an isError tool result for model recovery.
Real products, models, and research that use this idea.
- A filesystem server asked to read a missing file returns `{isError: true, content: [{type: 'text', text: 'File not found: /path/to/missing.ts'}]}`. The model on the next turn retries with a corrected path or asks the user.
- A database server asked to run invalid SQL returns `{isError: true, content: [{type: 'text', text: 'SQL syntax error at line 3: unexpected FROM'}]}`. The model corrects the SQL and retries.
- When the host calls `resources/list` against a server that did not advertise the resources capability, the server returns JSON-RPC error `-32601 method not found`. The host logs the violation; the model never sees it.
- MCP Inspector distinguishes the two paths visually: isError results appear in red within a normal response panel, while JSON-RPC errors appear in a separate error panel with the numeric code displayed.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhat is the right path for a tool that hit an unexpected exception during execution?
QShould the host reformulate -32602 invalid params into a tool error the model can see?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Returning a JSON-RPC error for tool business-logic failures. The model never sees JSON-RPC errors. Use `isError: true` in the result so the model can read the failure and decide how to recover.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.