Repository navigation
fix(mcp): give clashing MCP tool names a server prefix; clear build warnings - #220
Merged
Merged
Conversation
- Two MCP servers with a tool of the same name, or one shadowing a built-in,
made the provider reject every request ("Tool names must be unique")
- Clashing MCP tools are offered as <server>_<tool>; built-ins keep their
names so @mentions and tool-specific code still find them
- The rename only changes the name, so calls, approval gates and read-only
hints still reach the server's own tool
- CS4014: the auto-title task is meant to run alongside the next prompt, so it's discarded explicitly instead of awaited; it handles its own errors - CA2022: the idle-timeout test expects the read to throw, so it uses ReadExactlyAsync rather than ignoring ReadAsync's count - CS8619: the stderr test's env helper takes the nullable values Env holds
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.
Why
When two MCP servers expose a tool with the same name, every request fails with a 400:
tools: Tool names must be unique. The same happens when a server's tool shares a name with a built-in one, such asread_file. #219 makes this likelier: a server the launcher provides and one you saved can be the same server under different names. I hit it while testing the VS Code MCP view.What
McpToolNames.Disambiguate: an MCP tool whose name another tool also has is offered as<server>_<tool>, such asSql_query_database.@mentionsand other code that looks tools up by name still finds them._. Names stay within 64 characters, and a name that's already taken gets_2.DelegatingAIFunctionthat changes only the name. Calls, schema andGetServicego to the server's own tool, so REPL approval gates and read-only hints still apply.GetActiveTools, which also feedsChatOptions;ConvertPluginTools);SubagentPlugins.Also: the build's three warnings
The build now has none.
ReplTurn: the auto-title task (ReplAutoTitle.MaybeStart) runs alongside the next prompt on purpose and handles its own errors. It's discarded explicitly (_ =) instead of awaited, so behavior doesn't change.SseEventIdleTimeoutStreamTests: the byte-idle test expects the read to throw, so it usesReadExactlyAsyncinstead of ignoringReadAsync's count. It still goes through the stream'sReadAsync(Memory<byte>).McpSessionManagerStderrTests: the env helper now takesDictionary<string, string?>, matchingMcpServerConfig.Env.Testing
McpToolNamesTests:GetService;AgentToolResolverTestscovers an agent's tools and a subagent's tools.ReplCommandsMcpServerLifecycleTestscoversGetActiveToolsandChatOptions. Each fails if its wiring is removed.Local_list_databasesandSql_list_databases.Sql_list_databasesand got the server's answer, where before every turn failed./mcpstill lists each server's tools under their own names.