[BUG] API Error 400: MCP tool names exceeding 64 character limit
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?
Description
When using MCP tools with long names, Claude Code throws an API error because the combined tool name exceeds the
64-character limit enforced by the API.
## Error Message
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.6.content.0.tool_result.c
ontent.0.tool_reference.tool_name: String should have at most 64 characters"}}
## Root Cause
MCP tool names follow the pattern mcp__[server_name]__[tool_name]. When the server name and tool name are both
lengthy, the combined string exceeds 64 characters.
Examples from Zapier MCP integration:
mcp__claude_ai_Zapier__google_sheets_lookup_spreadsheet_rows_advanced(70 chars)mcp__claude_ai_Zapier__google_calendar_create_detailed_event(61 chars)
The error triggers when Claude references a tool result from a long-named tool in subsequent messages.
## Environment
- Claude Code CLI
- MCP server: Zapier integration (server name:
claude_ai_Zapier) - Affected tools: Primarily Google Sheets, Google Calendar, and other multi-word tool names
## Workaround
Avoid using MCP tools with long names, or reconfigure MCP servers to use shorter server names.
What Should Happen?
## Expected Behavior
Claude Code should either:
- Truncate/hash long tool names to stay within API limits
- Warn users during MCP configuration if tool names will exceed limits
- Handle the naming collision gracefully
Error Messages/Logs
<img width="948" height="106" alt="Image" src="https://github.com/user-attachments/assets/636420a8-c3e1-4452-81f0-0982381fd9fb" />
Steps to Reproduce
- Configure an MCP server with a moderately long name (e.g.,
claude_ai_Zapier) - Start a Claude Code session
- Use ToolSearch to load a tool with a long name (e.g.,
select:mcp__claude_ai_Zapier__google_sheets_lookup_spreadsheet_rows_advanced)
- Execute the tool successfully
- Continue the conversation where Claude needs to reference the tool result
- Error triggers on the follow-up message
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.20
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 15 comments on GitHub. Read the full discussion on GitHub ↗