[BUG] Custom remote MCP connector: tools/call result with embedded binary resource (`type: "resource"` + `blob`) fails schema validation

Status Open
Maintainer reply None cached
Activity 1 comment · opened Sep 13, 2026

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 a custom remote MCP connector's tool returns an embedded binary resource
(content: [{ type: "resource", resource: { uri, mimeType, blob } }]), the
tools/call result fails client-side schema validation with
"MCP error -32602: Invalid tools/call result", even though the server's raw
HTTP response is verified to be well-formed and contains a valid non-empty
base64 blob.

Two issues were found while debugging:

  1. _meta handling: Initially our resource object had no _meta key at

all (omitted). The validation error reported _meta: expected record,
received null
— implying some client-side normalization step defaults
an absent _meta to null rather than leaving it undefined, which
then fails an .optional()-style Zod check. Explicitly adding
"_meta": {} to our resource object resolved this specific error.

  1. blob disappearing: After fixing (1), validation still fails, now

reporting both text and blob as undefined inside the resource
union — even though:

  • Calling our backend directly (bypassing the connector) with the same

request returns a well-formed JSON body with a correctly populated
blob string.

  • Our reverse-proxy's access log confirms a reasonably-sized response

(several KB, matching the expected base64 payload) was actually
returned — not truncated to near-zero bytes.

This suggests the blob field is being dropped somewhere between our
server's response and the client-side schema validation, specific to
custom/remote connectors.

Non-binary tool results (type: "text") from the same server, over the same
connector, work correctly.

What Should Happen?

The tool result should validate successfully and the binary content
(resource + blob) should be available to Claude, per the MCP specification
for embedded resources.

Error Messages/Logs

MCP error -32602: Invalid tools/call result: [
  {
    "code": "invalid_union",
    "errors": [
      [{"code":"invalid_type","path":["text"],"message":"Invalid input: expected string, received undefined"}],
      [{"code":"invalid_type","path":["data"],"message":"Invalid input: expected string, received undefined"},
       {"code":"invalid_type","path":["mimeType"],"message":"Invalid input: expected string, received undefined"}],
      ...
      [
        {"code":"invalid_union","errors":[
          [{"code":"invalid_type","path":["text"],"message":"Invalid input: expected string, received undefined"}],
          [{"code":"invalid_type","path":["blob"],"message":"Invalid input: expected string, received undefined"}]
        ],"path":["resource"],"message":"Invalid input"}
      ]
    ],
    "path": ["content", 0],
    "message": "Invalid input"
  }
]

Steps to Reproduce

  1. Register a custom remote MCP connector whose server implements

JSON-RPC 2.0 over Streamable HTTP (protocolVersion "2024-11-05").

  1. Implement a tool whose tools/call result returns:

{
"content": [{
"type": "resource",
"resource": {
"uri": "example://some/path",
"mimeType": "application/zip",
"blob": "<base64 data>",
"_meta": {}
}
}]
}

  1. From a Claude.ai chat, call this tool through the connector.
  2. Observe MCP error -32602 (see Error Messages/Logs).
  3. Verify (e.g. via curl directly to the backend, bypassing the connector)

that the server's actual HTTP response contains a correctly populated
blob string of reasonable size — ruling out a server-side bug.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.243 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

This issue occurred using a custom remote MCP connector (self-hosted PHP
backend, not one of Anthropic's first-party connectors) registered via
Claude.ai's custom connector feature. The connector correctly handles
JSON/text tool results; only embedded binary resource content (blob) is
affected.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗