API Error: tool_reference.tool_name exceeds 64 characters in long conversations with MCP tools

Resolved 💬 4 comments Opened Jan 29, 2026 by danielraffel Closed Mar 11, 2026

Description

After approximately 116 messages in a conversation using MCP tools, all subsequent MCP tool calls fail with an API validation error related to tool name length.

Error Message

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

Reproduction Steps

  1. Install the worktree-manager plugin from the marketplace:

``
/plugin marketplace add danielraffel/generous-corp-marketplace
/plugin install worktree-manager@generous-corp-marketplace
``

  1. Use Claude Code in a long conversation (~100+ messages)
  2. Invoke any MCP tool from the plugin (e.g., /worktree-manager:list)
  3. Observe the API error

Observations

  • The MCP tool names themselves are within the 64-character limit (longest is mcp__plugin_worktree-manager_worktree__worktree_delete_branch at 61 characters)
  • The tool actually executes successfully (returns "success": true) before the error occurs
  • The error appears to be in how tool results are formatted/referenced in the conversation history
  • Starting a new session resolves the issue
  • The error persists across all MCP tool calls once it starts occurring

Environment

Expected Behavior

MCP tools should continue to work regardless of conversation length.

Actual Behavior

After ~116 messages, all MCP tool calls fail with tool_reference.tool_name: String should have at most 64 characters error.

View original on GitHub ↗

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