Skip to content

Build the MCP tool identifier in one place - #395

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-5673-mcp-tool-identifier-mcp__server__tool-is-built-independently
Aug 8, 2026
Merged

Build the MCP tool identifier in one place#395
TheGreatAxios merged 1 commit into
mainfrom
cl-5673-mcp-tool-identifier-mcp__server__tool-is-built-independently

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • The 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 in tool-permissions.ts for prefix-stripping on server disconnect.
  • Added mcpToolPrefix and mcpToolName to src/mcp/tool-name.ts, co-located with the existing MCP_PREFIX and parseMcpToolName, 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 for mcpToolName, mcpToolPrefix, and round-trip with parseMcpToolName
  • bun run typecheck — passes for touched files (pre-existing unrelated ArkErrors typing failures in vendor/tui/util)
  • bun run build — succeeds
  • bun run test — 4142 pass, 1 pre-existing unrelated failure (lsp-availability.test.ts, environment language-server detection, not touched by this change)

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.
@linear-code

linear-code Bot commented Aug 8, 2026

Copy link
Copy Markdown

CL-5673

@TheGreatAxios
TheGreatAxios merged commit 360a999 into main Aug 8, 2026
3 checks passed
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.

1 participant