MCP tool errors vs protocol errors and what my agent actually sees
The MCP spec, my FastMCP server and my agent each answer a bad tool call differently. Here's the wire output, and what reaches the model.

The MCP spec, the FastMCP server and the agent each give a different answer to a call for a tool that doesn't exist. The spec calls it a protocol error (-32602), FastMCP returns a tool result with isError: true, and my agent never sends the call at all. I found this while studying for the Linux Foundation's MCPA exam (built on the 2026-07-28 spec), using ConsoleTrack's k8s-mcp server as my lab.
Protocol error vs tool execution error
The spec's Error Handling section splits tool failures into two kinds, and states who should see each:
Clients MAY provide protocol errors to language models, though these are less likely to result in successful recovery. Clients SHOULD provide tool execution errors to language models to enable self-correction.
| Protocol error | Tool execution error | |
|---|---|---|
| Envelope and fields | JSON-RPC error: code, message, optional data |
result: content plus isError: true |
resultType |
None | Present, "complete" even on failure |
| Spec examples | Unknown tool; malformed request (fails the CallToolRequest schema); server error |
API failure; input validation (wrong date format, value out of range); business logic error |
What came back
The lab is running a dual-era FastMCP 4.1.4 server on mcp 2.3.0. Tests were manually written requests (2026-07-28) sent locally over stdio against a kind cluster. The captures below are from stdio; ConsoleTrack's agent reaches k8s-mcp over Streamable HTTP (McpToolProvider).
The requests below are shortened; responses are exactly as returned.
- Tool execution error: a namespace outside the allowlist
Client → Server: { "jsonrpc": "2.0", "id": 4, "method": "tools/call", "params": { "name": "get_pod_logs", "arguments": { "namespace": "kube-system", ... }, "_meta": { ... } } }
Server → Client: {"jsonrpc":"2.0","id":4,"result":{"content":[{"text":"namespace 'kube-system' is outside K8S_ALLOWED_NAMESPACES (demo)","type":"text"}],"isError":true,"resultType":"complete","_meta":{"io.modelcontextprotocol/serverInfo":{"name":"k8s-mcp","version":"4.1.4"}}}}
FastMCP returns a result with isError: true and resultType: "complete", and a message from a deliberate ToolError naming the allowed namespace so the model can fix it.
- Unknown tool: a tool that doesn't exist
Client → Server: { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "delete_cluster", "arguments": {}, "_meta": { ... } } }
Server → Client: {"jsonrpc":"2.0","id":1,"result":{"content":[{"text":"Unknown tool: 'delete_cluster'","type":"text"}],"isError":true,"resultType":"complete","_meta":{"io.modelcontextprotocol/serverInfo":{"name":"k8s-mcp","version":"4.1.4"}}}}
Same shape as output 1. I sent this directly to the server; ConsoleTrack's agent wouldn't do this. More on that below.
- Malformed request:
_metawithoutprotocolVersion
Client → Server: {"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/clientCapabilities":{}}}}
Server → Client: {"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"Invalid request parameters","data":""}}
Invalid Params error code -32602 and an empty data. A missing required _meta key makes any request malformed, so it's rejected with -32602 before the server looks at the method.
- Unknown method: a method that doesn't exist
Client → Server: { "jsonrpc": "2.0", "id": 1, "method": "tools/explode", "params": { "_meta": { ... } } }
Server → Client: {"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found","data":"tools/explode"}}
Method Not Found error code -32601, and data echoes the method.
All four requests were rerun over Streamable HTTP and matched, except output 3's message is more specific, and HTTP adds a status code (200, 400 or 404).
Unknown tool: the spec vs the SDK
Of the four, only the unknown tool breaks from the spec: the spec lists it as a protocol error, but FastMCP returns a tool execution error. FastMCP isn't alone: the official MCP Python SDK documents this as deliberate, and says why:
the model chose the call, so the model gets the message and a chance to try again.
Notably, the Ruby SDK moved unknown tools to isError (#194) and later back to a protocol error (#231).
If a host, or monitoring around it, expects the spec's -32602 for an unknown tool, it can misread the answer. For example, when a host checks for a JSON-RPC error to detect failures and sees a result instead, it treats the call as successful. Monitoring that counts protocol errors can miss these calls too, since they arrive as HTTP 200 responses over Streamable HTTP.
I found no option to choose -32602 over an isError result in FastMCP's tools docs, and the FastMCP 3 → 4 upgrade notes don't mention unknown tools.
What the agent actually sees
Here's where each type of error stops in ConsoleTrack's agent, and what the model reads:
Layer 1: unknown tool. Output 2 is what the server answers when a host passes the bad name along. ConsoleTrack's agent doesn't: Toolbox (the host's tool router) answers unknown tool 'x' itself, so a call for delete_cluster never leaves the agent.
async def call(self, tool: str, arguments: dict[str, Any]) -> ToolResult:
provider = self._owner.get(tool)
if provider is None:
return ToolResult(f"unknown tool {tool!r}", is_error=True)
...
Layer 2: tool execution errors. raise_on_error=False passes isError through and the model reads the server's message, as the spec's SHOULD asks.
async def call(self, tool: str, arguments: dict[str, Any]) -> ToolResult:
try:
result = await self._client.call_tool(
tool, arguments, raise_on_error=False, timeout=self._timeout
)
except Exception as exc: # transport errors, timeouts: the model sees a tool error
log.warning("tool call failed server=%s tool=%s error=%s", self.name, tool, exc)
return ToolResult(f"{self.name} call failed: {type(exc).__name__}", is_error=True)
...
return ToolResult(text, is_error=result.is_error)
Layer 3: protocol or transport errors. The model receives only k8s-mcp call failed: <ExceptionType>, and the details are logged. A JSON-RPC error and a timeout raise the same MCPError in mcp 2.3.0, so the model can't tell a rejected request from one that was never answered, or decide whether to retry.
How much should the model see?
The error in output 1 names the allowed namespace, so the model can retry correctly. ToolError messages still get through with mask_error_details=True, which hides only unexpected failures:
# Unexpected exceptions reach the client as a generic error; ToolError messages (the scope
# refusals) still go through, so the model learns why a call was refused.
mcp = FastMCP("k8s-mcp", instructions=INSTRUCTIONS, mask_error_details=True)
While it's helpful for the model to know that kube-system is not allowed, it exposes the allowlist to any caller. This isn't too concerning for a read-only server like k8s-mcp, but it shows how error text can reveal real infrastructure names to anyone probing the server.
In an earlier ConsoleTrack post on the sibling aws-mcp server, I demonstrated how a tag value on a cloud resource could be used maliciously to carry out an indirect prompt injection. An error message naming real namespaces tells an attacker where the agent looks, which is half of what an injection like that needs.
In hindsight, I'd reconsider whether the allowlist belongs in the error text at all. A generic message, with details in the logs, might be sufficient. Additionally, middleware options could be explored that return -32602 for unknown tools. I haven't tried either yet since Toolbox already catches unknown tools, and an allowlist leak on a read-only server is low risk.
SDKs don't all agree, so when building an MCP host, check both isError and JSON-RPC error, because an unknown tool can arrive as either. Have you checked what your SDK returns for an unknown tool?
Links
ConsoleTrack on GitHub · MCP spec 2026-07-28: Tools, Error Handling · MCP Python SDK: Troubleshooting · Ruby SDK PR #194 · Ruby SDK PR #231 · FastMCP: Tools · FastMCP: Upgrading from FastMCP 3 · FastMCP: Middleware · Defending an MCP server against prompt injection through CloudTrail
Built with Claude Code. Written by me, with illustrations, editing feedback and fact-checking support from Claude. The design, decisions, and final fact-checking are mine.
About the author
- Hi there! I'm a Cloud Engineer and SRE, documenting my transition into AI/ML Platform Engineering. I write technical deep-dives, hands-on implementation guides, CLI helper scripts, and visual architectures covering cloud, infrastructure, orchestration, governance, and modern AI runtimes.
Comments
Join the discussionNo comments yet. Be the first to comment.
DevEx
Hands-on developer experience: CLI utilities and tooling, local environment debugging, and real-world implementation guides. Features standalone admin scripts (Boto3, AWS search utilities, shell tools), and agentic developer workflows (Claude Code setups, guardrail hooks and reviewer agents, uv environments, custom MCP integrations).



