{"record":{"id":"37bb22a2a9576561","repo":"Hmbown/CodeWhale","slug":"qualified-mcp-tool-name-qualified-tool-name-is","errorCode":null,"errorMessage":"qualified MCP tool name '{qualified_tool_name}' is ambiguous across servers: {}","messagePattern":"qualified MCP tool name '(.+?)' is ambiguous across servers: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mcp/src/lib.rs","lineNumber":519,"sourceCode":"            }\n        }\n        match matches.len() {\n            0 => {}\n            1 => {\n                let (server_name, tool_name) = &matches[0];\n                let client = self\n                    .clients\n                    .get(*server_name)\n                    .with_context(|| format!(\"MCP server '{server_name}' not available\"))?;\n                return client.call_tool(tool_name, arguments);\n            }\n            _ => {\n                matches.sort();\n                let servers: Vec<&str> = matches\n                    .iter()\n                    .map(|(server_name, _)| server_name.as_str())\n                    .collect();\n                bail!(\n                    \"qualified MCP tool name '{qualified_tool_name}' is ambiguous across servers: \\\n                     {}\",\n                    servers.join(\", \")\n                );\n            }\n        }\n\n        let (server_name, tool_name) = parsed?;\n        self.call_tool(&server_name, &tool_name, arguments)\n    }\n\n    /// List all resources from all running servers.\n    pub fn list_resources(&self) -> Result<Vec<McpResourceDescriptor>> {\n        Ok(self\n            .list_resources_with_metadata()?\n            .into_iter()\n            .map(|(resource, _)| resource)\n            .collect())","sourceCodeStart":501,"sourceCodeEnd":537,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/mcp/src/lib.rs#L501-L537","documentation":"call_qualified_tool resolves a qualified tool name (mcp__server__tool form, or sanitized variants) to a server. When the tool portion matches tools advertised by MORE than one running server, resolution cannot pick one, so the manager fails closed with the list of conflicting servers. This prevents silently invoking the wrong server's tool.","triggerScenarios":"Calling McpManager::call_qualified_tool with a qualified name whose tool segment (or sanitized/truncated form) matches tools on two or more connected servers that advertise the same tool name.","commonSituations":"Two MCP servers expose identically named tools (e.g., both expose 'search'); sanitized names collide after character normalization; truncated names from long server/tool names collide; connecting a second server that duplicates an existing one's tool catalog.","solutions":["Use the fully unambiguous qualified form including the exact server segment (the raw server name, not a sanitized/collision-prone one), e.g. mcp__github__search instead of a sanitized shorthand.","Rename or remove the duplicate tool on one of the servers, or disconnect one of the conflicting servers.","Inspect the server list in the error message and pick the intended server explicitly, calling client.call_tool(server, tool) via the manager's per-server API."],"exampleFix":"// before\nmanager.call_qualified_tool(\"mcp__search\")  // ambiguous: fs, web\n// after\nmanager.call_qualified_tool(\"mcp__web__search\")","handlingStrategy":"validation","validationCode":"fn is_unambiguous(manager: &McpManager, qualified: &str) -> Result<(), String> {\n    let tool = qualified.rsplit(\"__\").next().unwrap_or(qualified);\n    let owners: Vec<_> = manager.clients.iter()\n        .filter(|(s, _)| manager.tool_exists(s, tool))\n        .map(|(s, _)| s.clone()).collect();\n    if owners.len() > 1 { Err(format!(\"ambiguous: {}\", owners.join(\", \"))) } else { Ok(()) }\n}","typeGuard":null,"tryCatchPattern":"match manager.call_qualified_tool(name) {\n    Err(e) if e.to_string().contains(\"is ambiguous across servers\") => {\n        // parse server list from message, prompt user or pick configured default server\n    }\n    other => other?,\n}","preventionTips":["Always qualify with the exact raw server segment: mcp__<server>__<tool>.","Rename duplicate tool names across servers at the source.","At startup, scan the combined catalog for tool names advertised by more than one server and warn or auto-qualify."],"tags":["mcp","naming-collision","ambiguity"],"backgroundTag":"invalid-identifier-format","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}