What are MCP tool errors? Reading failed calls
By Flavio
MCP tool errors report failures inside a tool result. Learn how isError differs from a protocol error, with real validation and empty-search examples.
MCP tool errors are failed operations reported inside a tool result with isError: true. They give the model feedback it can use to correct the call, such as fixing an argument outside the allowed range.
Build an MCP server shows real validation failures, handler errors, and an empty search. That tutorial keeps the implementation and tests.
How tool errors work
MCP separates failures in the protocol request from failures reported by the tool. The tools specification defines both forms.
| Response | What it means | Recorded example |
|---|---|---|
Top-level error | Protocol request failed | Unknown tool in the filesystem trace |
result with isError: true | Tool reports failure | Search limit outside the accepted range |
| Successful empty result | Operation completed, no matches | search_posts with zzqqxx |
In coding tools
Claude Code documents that a result marked isError: true gives Claude the result’s text as an error message.
Cursor documents MCP logs containing tool calls and errors. It also marks calls as failed when a server crashes or times out. A lost connection is a different failure from a server returning isError.
The connection guides for Codex and Grok Build do not specify their handling of this field. Check the actual returned result and the client’s diagnostics.
Details checked against each vendor’s documentation in November 2026.
A real example
In the server tutorial, calling search_posts with limit: 21 returned this tool-result body:
{
"content": [
{
"type": "text",
"text": "Input validation error: Invalid arguments for tool search_posts: limit: Too big: expected number to be <=20"
}
],
"isError": true
}
The model can lower the limit and try again. The same tutorial’s search for zzqqxx returned {"total":0,"results":[]} successfully. An empty collection is a valid search answer.
When to use it
Check this distinction when an agent reports success after a failed tool call, or keeps retrying a request without changing its arguments.
When building a server, return a useful error message with enough detail to fix the call. The protocol recommends making tool execution errors available to the model.
Pitfalls
Error text can expose sensitive information. The server tutorial demonstrates a thrown filesystem error leaking an absolute path. Catch backend failures and return a safe explanation.
Before retrying an operation that changes data, check whether it already took effect. A timeout can leave the outcome unknown. Accurate tool annotations help describe retry behavior, while the server still needs to handle retries safely.
Related on flaviocopes.com
- Build an MCP server tests the error paths and returned messages.
- What is MCP? compares protocol errors with denied filesystem reads.
- Buy a domain with an AI agent and approval shows Cloudflare Domains Toolkit’s approval flow for an operation that spends money.
Related glossary entries
- JSON-RPC: JSON-RPC carries requests and responses between MCP clients and servers. Learn to read message IDs, methods, results, and errors in a real coding-agent trace.
- Tool calling: Tool calling is when a model names a function and its arguments, and the app runs it. How Claude Code, Codex, Cursor and Grok Build take that step.
- MCP tool annotations: MCP tool annotations describe whether a tool reads, changes, or reaches external data. Learn what the hints mean and why servers still need access controls.
Want me to talk about your product? You can sponsor this site.