[BUG] /context shows 0 tokens for all MCP tools on Bedrock — countTokensWithFallback fails with 400 tools.0.custom.eager_input_streaming: Extra inputs are not permitted
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code (v2.1.153)
What's Wrong?
The /context command displays 0 tokens for every MCP tool (all 141 tools across atlassian, glean, azure-devops, snowflake, etc.) even after those tools have been actively used in the session. The same 0 tokens applies to all deferred tools (TaskCreate, WebFetch, CronCreate, etc.) and to the 8 built-in tools (Agent, Bash, Read, etc.).
The root cause, found in the debug log, is that the token counting fallback chain completely fails when running via Bedrock:
- The primary counter calls the Bedrock inference profile for
global.anthropic.claude-sonnet-4-6and getsnull(withRequest aborted). - It falls back to
global.anthropic.claude-haiku-4-5-20251001-v1:0via Bedrock, which returns a400error for every tool group:
countTokensWithFallback: fallback failed: 400 tools.0.custom.eager_input_streaming: Extra inputs are not permitted
countToolDefinitionTokens returned null for 141 tools: mcp__atlassian__addCommentToJiraIssue, ...
countToolDefinitionTokens returned null for 8 tools: Agent, AskUserQuestion, Bash, Edit, Read, Skill, ToolSearch, Write
The error tools.0.custom.eager_input_streaming: Extra inputs are not permitted suggests that Claude Code 2.1.153 sends a tool schema field (eager_input_streaming) that the Bedrock endpoint rejects as an unknown/extra field.
Importantly, actual tool calls work fine — the MCP tools execute successfully (e.g. getJiraIssue completed in 1.6s). Only the token-counting side-channel is broken, which makes /context unable to display meaningful token counts for any tool.
What Should Happen?
/context should display accurate per-tool-group token counts even on Bedrock. The fallback token counting mechanism should either:
- Not send the
eager_input_streamingfield when targeting a Bedrock endpoint that doesn't support it, or - Gracefully handle the
400 Extra inputs are not permittedand display a best-effort estimate instead of silently reporting0for everything.
Steps to Reproduce
- Configure Claude Code to use Bedrock (
CLAUDE_CODE_USE_BEDROCK=1or equivalent Bedrock routing). - Start a session with multiple MCP servers connected (atlassian, glean, azure-devops, etc.).
- Use any MCP tool (e.g.
mcp__atlassian__getJiraIssue). - Run
/context. - Observe: all MCP tools show
0 tokens, all deferred tools show0 tokens, built-in tools show0 tokens.
Debug Log Evidence
[ERROR] Failed to resolve Bedrock inference profile backing model for global.anthropic.claude-sonnet-4-6: Request aborted
[ERROR] countTokensWithFallback: fallback failed: 400 tools.0.custom.eager_input_streaming: Extra inputs are not permitted
[DEBUG] countToolDefinitionTokens returned null for 141 tools: mcp__atlassian__addCommentToJiraIssue, mcp__atlassian__addWorklogToJiraIssue, ...
[DEBUG] countToolDefinitionTokens returned null for 8 tools: Agent, AskUserQuestion, Bash, Edit, Read, Skill, ToolSearch, Write
[DEBUG] countToolDefinitionTokens returned null for 1 tools: CronCreate
[DEBUG] countToolDefinitionTokens returned null for 1 tools: WebFetch
... (repeated for every tool/group)
This is repeated identically every time /context is invoked.
Environment
- Claude Code: v2.1.153
- Platform: Linux (WSL2, 5.15.167.4-microsoft-standard-WSL2)
- Shell: zsh
- Model:
global.anthropic.claude-sonnet-4-6via Bedrock - MCP servers connected: atlassian, glean, azure-devops, snowflake, memory