Skip to content

Preserve MCP tools when sanitized names collide - #1711

Open
VIOLETee0 wants to merge 1 commit into
CodebuffAI:mainfrom
VIOLETee0:fix/mcp-tool-name-collision
Open

VIOLETee0 wants to merge 1 commit into
CodebuffAI:mainfrom
VIOLETee0:fix/mcp-tool-name-collision

Conversation

@VIOLETee0

Copy link
Copy Markdown

A server key such as files.prod exposes read as files_prod__read, which is also the unchanged name for files_prod/read. If the sanitized entry registers first, the legal entry overwrites it and one tool disappears. Registration also depended on the order in which server listings resolved.

Fetch catalogs concurrently, then register in configuration order after reserving the legal names. Give conflicting sanitized aliases a stable hash suffix, retain their original server/tool metadata, and check generated aliases for further conflicts. Legal names and non-colliding sanitized aliases retain their existing spelling.

One regression resolves the two server catalogs in both orders and checks that both definitions survive with the same names and original routing metadata. On unmodified main (49b6612d3), it fails with one definition instead of two; with this change it passes.

Validation on Windows with Bun 1.3.14:

  • 86 affected MCP/schema/argument/filter tests passed.
  • Agent-runtime and SDK TypeScript checks passed.
  • Frozen-lockfile install, SDK build, Windows Freebuff build, version, and official binary smoke passed.
  • Prettier and git diff --check passed.
  • ESLint: 0 errors, 4 TypeScript-resolver configuration warnings.

This is a catalog-registration regression using the existing injected listing boundary; no authenticated model/TUI session was run. The patch is independent of #1710 and does not change MCP transport caching.

This branch has not been deployed

No deployments
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