[BUG] MCP tool errors don't include the data field when surfaced to the model

Open 💬 0 comments Opened Jun 25, 2026 by justwiebe

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When an MCP tool call fails, Claude Code only shows the model the message field from the JSON-RPC error response. If the server also returned a data field with more detail, that gets dropped silently.

This matters because message is often generic ("Internal error") while data contains the actual useful context — the exception message, stack info, whatever the server put there. Without it, the model has nothing to work with.

Example

A server returns:
{
"jsonrpc": "2.0",
"id": 15,
"error": {
"code": -32603,
"message": "Internal error",
"data": "User(#19704) expected, got #<UserIdentity ...>"
}
}

The model receives "Internal error" and has no idea about the specifics.

Why this should work

data is part of the JSON-RPC 2.0 spec:

A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server.

The MCP spec also explicitly includes it in the error response schema:

error: {
code: number;
message: string;
data?: unknown;
}

See MCP Base Protocol – Messages (https://spec.modelcontextprotocol.io/specification/draft/basic/).

What Should Happen?

Claude Code should receive both message and data in an error response so it can reason about what actually went wrong.

Error Messages/Logs

Steps to Reproduce

Create an MCP server that returns an error response with a data option. This should look like:

{
  "jsonrpc": "2.0",
  "id": 15,
  "error": {
    "code": -32603,
    "message": "Internal error",
    "data": "More detailed message to help Claude reason about what's wrong."
  }
}

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.191 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Warp

Additional Information

_No response_

View original on GitHub ↗