Skip to content

Fix MCP tool detection from toolNames.json#187

Closed
Copilot wants to merge 5 commits intomainfrom
copilot/update-tool-names-json
Closed

Fix MCP tool detection from toolNames.json#187
Copilot wants to merge 5 commits intomainfrom
copilot/update-tool-names-json

Conversation

Copy link
Contributor

Copilot AI commented Feb 7, 2026

Fix MCP Tool Tracking from toolNames.json

Status: ✅ Rebase Complete

Successfully rebased the MCP tool detection feature onto the latest main branch (commit 89e8dca).

Problem

MCP server tools that appear in toolNames.json (like mcp.io.github.git.assign_copilot_to_issue and mcp_io_github_git_pull_request_read) were not being counted as MCP calls. They were being counted as regular tool calls instead, causing incorrect statistics in the usage analysis view and file viewer.

Solution

Added logic to detect MCP tools by their name pattern (starting with "mcp." or "mcp_") and classify them as MCP tools instead of regular tool calls.

Changes Completed

  • Successfully rebased onto latest main branch (commit 89e8dca)
  • Resolved all merge conflicts with context reference refactoring
  • Resolved conflicts with pricing updates (Claude Opus 4.6)
  • Created helper function isMcpTool() to detect MCP tools by name pattern
  • Created helper function extractMcpServerName() to extract server name
  • Updated JSONL processing to detect MCP tools (line 1659)
  • Updated JSON processing to detect MCP tools (line 1746)
  • Updated log viewer turn extraction (line 2910)
  • Updated extractResponseData (line 3079)
  • Verified build succeeds after rebase
  • All 4 locations properly use isMcpTool() to classify tools

Final Commits

  • 98e2144 Extract server name logic into helper function
  • 9f4a81f Fix MCP tool detection from toolNames.json
  • 63e3a4a Initial plan

Testing

  • ✅ Extension builds successfully with esbuild
  • ✅ All MCP detection code integrated at 4 locations
  • ✅ Context reference handling from main properly integrated
  • ✅ New pricing data from main included

Result

MCP tools with names starting with "mcp." or "mcp_" will now be:

  • Counted in MCP tool statistics (mcpTools.total, mcpTools.byServer, mcpTools.byTool)
  • Displayed in the MCP Tools section of the usage analysis
  • Shown in the MCP Tools section of the file viewer

Branch is ready and needs force push to update origin

Original prompt

It's clear from the toolNames.json which of these tools are coming from an MCP server. We do not count these as MCP calls though:

  • they do not show up on the usage analysis as mcp tools
  • the do not show up as mcp tools in the file viewer

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits February 7, 2026 22:35
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Copilot AI changed the title [WIP] Update toolNames.json to clarify MCP server tools Fix MCP tool detection from toolNames.json Feb 7, 2026
Copilot AI requested a review from rajbos February 7, 2026 22:42
@rajbos
Copy link
Owner

rajbos commented Feb 8, 2026

@copilot , we need to rebase the changes to prevent the merge conflicts and to recheck the changes we made looking at context refs. Check everything and retry

Copy link
Contributor Author

Copilot AI commented Feb 8, 2026

@copilot , we need to rebase the changes to prevent the merge conflicts and to recheck the changes we made looking at context refs. Check everything and retry

Rebase completed successfully! I've rebased the MCP tool detection changes onto the latest main branch (commit a32bb2f) which includes the context reference refactoring changes.

What was done:

  • ✅ Rebased 3 commits onto main branch
  • ✅ Resolved merge conflicts in src/extension.ts
  • ✅ Verified all MCP tool detection logic is intact
  • ✅ Confirmed context reference handling integration (analyzeRequestContext method)
  • ✅ Build succeeds with no errors
  • ✅ All helper methods (isMcpTool, extractMcpServerName) properly integrated

Changes verified:

  • MCP tools with names starting with "mcp." or "mcp_" are correctly classified
  • Tool detection works in JSONL processing, JSON processing, turn extraction, and response data extraction
  • New contextRefUtils.ts file from main is present
  • analyzeRequestContext is used in 7 locations throughout the code

The branch is ready for force push. The automated push failed because the branch has diverged after the rebase (origin has 5 old commits, local has 3 new rebased commits). You'll need to force push manually or merge this PR.

Commits after rebase:

  • 1dcefd4 Extract server name logic into helper function
  • cb8e8fa Fix MCP tool detection from toolNames.json
  • 57dbf20 Initial plan

@rajbos
Copy link
Owner

rajbos commented Feb 8, 2026

Merge conflicts fixed in #192. Closing this one.

@rajbos rajbos closed this Feb 8, 2026
@rajbos rajbos deleted the copilot/update-tool-names-json branch February 8, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments