[BUG] API Error 400: MCP tool names exceeding 64 character limit

Status Fixed / completed
Reported on v2.1.20
Maintainer reply ✓ Yes — localden
Activity 15 comments · opened Jan 27, 2026 · closed Jul 9, 2026
💡 Likely answer: A maintainer (localden, collaborator) responded on this thread — see the highlighted reply below.

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:

  1. Truncate/hash long tool names to stay within API limits
  2. Warn users during MCP configuration if tool names will exceed limits
  3. 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

  1. Configure an MCP server with a moderately long name (e.g., claude_ai_Zapier)
  2. Start a Claude Code session
  3. Use ToolSearch to load a tool with a long name (e.g.,

select:mcp__claude_ai_Zapier__google_sheets_lookup_spreadsheet_rows_advanced)

  1. Execute the tool successfully
  2. Continue the conversation where Claude needs to reference the tool result
  3. 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_

View original on GitHub ↗

15 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/20635
  2. https://github.com/anthropics/claude-code/issues/20643
  3. https://github.com/anthropics/claude-code/issues/21050

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

pjurczen · 7 months ago

Getting this error now as well. API seems broken.

TuringQuiz · 7 months ago

+1

tarunt815 · 7 months ago

+1 having this issue since todos update came out

yteruel31 · 7 months ago

Same for me

kalepail · 7 months ago

Please fix 😬

gustav · 7 months ago

used to be 128 I believe

edgeq · 7 months ago

+1 - Current workaround is to remove the "ENABLE_TOOL_SEARCH": "true" flag in ~/.claude/settings.json

vlad-tsoy · 7 months ago

+1

@edgeq thank you for the workaround, it's working for me

zskyfly · 7 months ago

+1 Encountering this same issue.

Environment:

  • Claude Code version: 2.1.27
  • OS: macOS
  • Terminal: zsh

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

Reproduction scenario:
My case involved using an MCP tool (JIRA integration) after running git diff HEAD --name-only on files with long nested paths. The issue seems to
occur when Claude constructs tool references that include long file paths or action names.

Critical impact: Once this error occurs, the conversation becomes permanently unrecoverable—resuming replays the same error every time, forcing
complete loss of context. This is especially painful in long multi-step workflows.

alexef · 6 months ago

Extremely frustrating when mcps are shipped as claude plugins, via marketplace. That adds up to the tool name, impossible to fit in 64 chars. @bcherny can you take a look? There are so many open requests on this problem.

I'm pretty sure I saw a comment this was fixed back in August 2025, but cannot find it any more.

ImreLbdv · 5 months ago

Still happening

KingAmo · 3 months ago

any update ?

localden collaborator · 1 month ago

The 64-char cap on tool_reference.tool_name was bumped to 256 server-side back in early Feb, no CC upgrade needed. The 69-char name in the OP is fine now.

There's a "still happening" comment from March with no details. If anyone can still repro, reopen with the request_id.