[BUG] Claude Code MCP tool calls fail with 'String should have at most 64 characters' error due to internal prefix addition.

Resolved 💬 7 comments Opened May 4, 2025 by chrisvanbuskirk Closed Jan 3, 2026

Environment

  • Platform (select one):
  • [X] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: v0.2.100
  • Operating System: macOS 15.4.1
  • Terminal: Terminal App

Bug Description

Claude Code MCP tool calls fail with 'String should have at most 64 characters' error due to internal prefix addition.

The issue occurs when Claude Code internally prefixes MCP tool names with something like tools.48.custom., causing tools with longer names to exceed the 64-character API limit.

Steps to Reproduce

  1. Configure an MCP server (e.g., XcodeBuildMCP) with tool names >40 characters
  2. Add the server to Claude Code configuration:

``json
{
"mcpServers": {
"XcodeBuildMCP": {
"command": "mise",
"args": ["x", "npm:xcodebuildmcp@1.3.4", "--", "xcodebuildmcp"]
}
}
}
``

  1. Start Claude Code and attempt to use any tool
  2. Error occurs even for simple commands like "list_simulators"

Expected Behavior

MCP tools should execute successfully, as they do when:

  1. Testing the MCP server directly with JSON-RPC
  2. Using the same server in Claude Desktop app

Actual Behavior

> list_simulators
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools.48.custom.name: String should have at most 64 characters"}}

Additional Context

  • The MCP server exposes tools with names like:
  • ios_simulator_build_and_run_by_name_workspace (45 characters)
  • ios_simulator_build_and_run_by_name_project (43 characters)
  • get_simulator_app_path_by_name_workspace (40 characters)
  • These tool names work fine when calling the MCP server directly
  • The error message suggests Claude Code adds a prefix like tools.48.custom. to the tool name
  • This same server works correctly in Claude Desktop app
  • Possibly related to Issue #467 on GitHub

Diagnostic Information

Running the MCP server directly shows the tools are properly exposed:

echo '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}' | mise x npm:xcodebuildmcp@1.3.4 -- xcodebuildmcp

Successfully returns all tools with their original names intact.

View original on GitHub ↗

This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗