MCP tool descriptions truncated at 2KB breaks code execution tools
Problem
Claude Code v2.1.84 introduced a hard-coded 2048-character limit on MCP tool descriptions (WoH=2048 in the compiled binary). This breaks MCP servers that use code execution tools with embedded function signatures.
Impact
Our MCP server provides a code_executor tool that embeds a <functions> block listing ~60 browser automation functions with their parameter signatures (~9,336 chars). After truncation, only 15 of 60 functions are visible (alphabetically: addInitScript through getBoundingBox). Core functions like pageNavigate, pageClick, takeSnapshot, pageScreenshot, and pageWait are completely invisible to the AI.
Result: The AI hallucinates Playwright-like function names (waitForLoadState, getSnapshot, snapshot, getConsoleMessages) that don't exist in the sandbox, causing tool execution failures.
Reproduction
- Create an MCP server with a tool whose description exceeds 2048 characters
- Use ToolSearch to fetch the tool definition
- Observe the description is truncated with
… [truncated]
Requested Fix
Add a configurable maxToolDescriptionLength setting in settings.json, or raise the default limit significantly (e.g., 16KB). Code execution tools legitimately need large descriptions to embed function signatures — this is the recommended pattern for making sandbox functions discoverable to the AI.
Current Workaround
Binary-patching the constant WoH=2048 → WoH=15e3 in the compiled binary (same byte length). This needs to be reapplied after every update.
Context
The limit was added to prevent OpenAPI-generated MCP servers from bloating context. A configurable per-server or per-tool override would solve both use cases — keeping defaults tight while allowing opt-in for tools that need it.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗