[BUG] VS Code extension /context incorrectly reports token usage for deferred (unloaded) MCP tools

Resolved 💬 2 comments Opened Feb 8, 2026 by swarooprajanna Closed Mar 8, 2026

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?

Environment
Claude Code CLI version: 2.1.37 & VS Code extension version: 2.1.37
Model: claude-opus-4-6[1m] (1M context)

<h3 style="color: rgb(204, 204, 204); font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, Roboto, sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">What's wrong (two places)</h3><h4 style="color: rgb(204, 204, 204); font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, Roboto, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">1. Summary table — "MCP tools (deferred)" category should not show token usage</h4>
Category | Terminal CLI (correct) | VS Code Extension (incorrect)
-- | -- | --
MCP tools (deferred) | Not shown (0 tokens) | 39.4k tokens (3.9%)

<p style="white-space: pre-wrap; margin-top: 0.1em; margin-bottom: 0.2em; color: rgb(204, 204, 204); font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, Roboto, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">The VS Code extension adds an "MCP tools (deferred)" row to the summary breakdown showing 39.4k tokens consumed. Since these tools are deferred and not loaded, this should show as <strong>zero</strong> — matching the Terminal CLI, which correctly omits this category.</p><h4 style="color: rgb(204, 204, 204); font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, Roboto, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">2. MCP Tools detail section — per-tool token counts should be zero or minimal</h4><ul style="padding-inline-start: 1.5em; color: rgb(204, 204, 204); font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, Roboto, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><li><strong>Terminal CLI (correct):</strong><span> </span>Lists MCP tool names in a simple tree with no token costs — consistent with deferred tools costing nothing</li><li><strong>VS Code Extension (incorrect):</strong><span> </span>Shows a full table with per-tool token counts (e.g.,<span> </span><code style="font-family: monospace; color: rgb(208, 208, 208); background-color: rgb(60, 60, 60); padding: 2px 4px; border-radius: 3px; font-size: 0.9em; word-break: break-word;">mcp__notion-official__notion-create-database: 5.8k</code>,<span> </span><code style="font-family: monospace; color: rgb(208, 208, 208); background-color: rgb(60, 60, 60); padding: 2px 4px; border-radius: 3px; font-size: 0.9em; word-break: break-word;">mcp__datadog__search_datadog_logs: 948</code>, etc.) as if each tool's schema is already loaded into context</li></ul><p style="white-space: pre-wrap; margin-top: 0.1em; margin-bottom: 0.2em; color: rgb(204, 204, 204); font-family: -apple-system, &quot;system-ui&quot;, &quot;Segoe UI&quot;, Roboto, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(24, 24, 24); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">These per-tool token counts should be <strong>zero or minimal</strong>, matching the Terminal CLI behavior, since the tools are deferred and only loaded on demand.</p>

<img width="683" height="877" alt="Image" src="https://github.com/user-attachments/assets/09b77397-202c-4f64-87ed-980750820a67" />
<img width="432" height="983" alt="Image" src="https://github.com/user-attachments/assets/62740f4e-3fca-4e86-946e-11efbc94d9ca" />

What Should Happen?

Expected Behavior
Both the summary table and the MCP tools detail section should report zero (or near-zero) token usage for deferred MCP tools, consistent with the Terminal CLI. Token costs for deferred tools should only appear after they are loaded via ToolSearch.

Error Messages/Logs

Steps to Reproduce

  1. Configure several MCP servers (Datadog, Slack, Notion, Snowflake, etc.)
  2. Start a new conversation — do not invoke any MCP tools
  3. Run /context in both the Terminal CLI and the VS Code extension
  4. Compare output

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

v2.1.37

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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