Build the MCP tool identifier in one place - #395
Merged
TheGreatAxios merged 1 commit intoAug 8, 2026
Merged
Conversation
plugin.ts and tool-permissions.ts each reimplemented the mcp__<server>__<tool> template literal independently of the parser in tool-name.ts, and tool-permissions.ts reconstructed the prefix a third time for stripping tiers on disconnect. A drift in the separator would have broken permission tiering or tool dispatch silently while parsing kept working. tool-name.ts now exports mcpToolPrefix and mcpToolName next to parseMcpToolName, and both call sites use them instead of local copies.
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.
Summary
mcp__<server>__<tool>identifier was built independently in three places:src/mcp/plugin.ts(mcpToolName),src/mcp/tool-permissions.ts(mcpAgentToolName), and a third inline reconstruction intool-permissions.tsfor prefix-stripping on server disconnect.mcpToolPrefixandmcpToolNametosrc/mcp/tool-name.ts, co-located with the existingMCP_PREFIXandparseMcpToolName, so one module owns the format. Both call sites now import and use them; the local duplicates and inline prefix template were deleted, no back-compat shims.Test plan
bun test src/mcp/tool-name.test.ts— new RED-first tests formcpToolName,mcpToolPrefix, and round-trip withparseMcpToolNamebun run typecheck— passes for touched files (pre-existing unrelated ArkErrors typing failures in vendor/tui/util)bun run build— succeedsbun run test— 4142 pass, 1 pre-existing unrelated failure (lsp-availability.test.ts, environment language-server detection, not touched by this change)