fix(ai): stop guessing the MCP server name VSCode leaves out - #1423
Open
amascia-gg wants to merge 1 commit into
Open
fix(ai): stop guessing the MCP server name VSCode leaves out#1423amascia-gg wants to merge 1 commit into
amascia-gg wants to merge 1 commit into
Conversation
VSCode names an MCP tool call "mcp_{mangled server}_{tool}" with no separator
between the two halves, so the split is only knowable against a list of known
configuration names. When no local configuration matches, the fallback cut the
name at the first "_" and reported the result as the server, which resolves to
nothing on the API side and drops the activity. The raw name is reported instead:
the API matches it against the inventory of the whole account, which is wider
than what one machine can see.
The history walk keeps the label that VSCode records next to the tool id, so it
now cuts the tool with the mangled label and needs no lookup. Without a discovery
cache it reported "no_notion-search" for a tool named "notion-search".
An empty tool name no longer raises IndexError, and the match loop no longer
tests the empty string on its first turn.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1423 +/- ##
=======================================
Coverage 94.00% 94.00%
=======================================
Files 200 200
Lines 12636 12638 +2
=======================================
+ Hits 11878 11880 +2
Misses 758 758
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
VSCode names an MCP tool call
mcp_{mangled server}_{tool}, where the server name is lowercased, has its non-alphanumeric groups replaced by_, and is cut at 13 characters. No separator marks the end of the server name, so the split is only knowable against a list of known configuration names.When no local configuration matches, the fallback cut the name at the first
_and reported the result as the server. That name matches nothing on the API side, so the activity is dropped and the API logs an error. This is one of the causes behind the "Server not found for MCP activity" Sentry issue (NHI-1927). The raw name is now reported with an empty server, and the API splits it against the inventory of the whole account, which is wider than what one machine can see. The API side is in ward-runs-app!27641.Two more fixes in the same path:
no_notion-searchfor a tool namednotion-search. It now cuts the tool with the mangled label, which needs no lookup and makes the live hook and the history agree.IndexErrorinside the hook, and the match loop tested the empty string on its first turn.Note for reviewers: #1419 makes VSCode detectable on macOS and Windows, so the local configuration list is populated much more often there and this fallback becomes the exception it should be.