MCP tool names can exceed 64-character API limit causing session-breaking errors

Resolved 💬 3 comments Opened Jan 24, 2026 by bassic-nerd Closed Jan 29, 2026

Description

When remote MCP servers are connected via Claude.ai, the tool naming convention (mcp__<server_namespace>__<tool_name>) can produce names exceeding the 64-character API limit, causing session-breaking errors.

Example

Tool names from Cloudflare Developer Platform MCP:

  • mcp__claude_ai_Cloudflare_Developer_Platform_2__hyperdrive_config_edit = 70 chars
  • mcp__claude_ai_Cloudflare_Developer_Platform_2__search_cloudflare_documentation = 79 chars
  • mcp__claude_ai_Cloudflare_Developer_Platform_2__migrate_pages_to_workers_guide = 78 chars

Error

When ToolSearch returns these tools, the API throws a 400 error:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.14.content.0.tool_result.content.3.tool_reference.tool_name: String should have at most 64 characters"},"request_id":"..."}

Impact

  • Breaks the current session
  • Prevents tool discovery from working
  • User must disconnect the problematic MCP servers to recover

Reproduction

  1. Connect Cloudflare Developer Platform MCP via Claude.ai integrations
  2. Start a Claude Code session
  3. Use ToolSearch to discover tools
  4. Session breaks with the above error

Suggested Fixes

  1. Truncate or hash long server names in the mcp__ prefix
  2. Validate tool name length before registering MCP tools and warn/reject if over limit
  3. Use shorter default names for built-in remote MCP connections (e.g., cloudflare instead of claude_ai_Cloudflare_Developer_Platform)
  4. Gracefully handle the error in ToolSearch rather than breaking the session

Workaround

Disconnect the duplicate Cloudflare MCP server from Claude.ai settings to remove the _2 suffix tools.

Environment

  • Claude Code CLI
  • macOS
  • Multiple MCP servers connected (local + remote via Claude.ai)

View original on GitHub ↗

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