{"record":{"id":"4ce222924f345e41","repo":"Hmbown/CodeWhale","slug":"ambiguous-mcp-tool-name-prefixed-name-matches","errorCode":null,"errorMessage":"Ambiguous MCP tool name '{prefixed_name}' matches more than one server/tool authority","messagePattern":"Ambiguous MCP tool name '(.+?)' matches more than one server/tool authority","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/mcp.rs","lineNumber":4456,"sourceCode":"            &serde_json::json!({}),\n        )?;\n        let Some(rest) = prefixed_name.strip_prefix(\"mcp_\") else {\n            anyhow::bail!(\"Invalid MCP tool name: {prefixed_name}\");\n        };\n\n        let mut matched: Option<(String, String)> = None;\n        for (server, connection) in &self.connections {\n            if !self.server_allowed(server) || !connection.catalog_authorized() {\n                continue;\n            }\n            for tool in connection.tools() {\n                if !connection.config().is_tool_enabled(&tool.name)\n                    || format!(\"{server}_{}\", tool.name) != rest\n                {\n                    continue;\n                }\n                if matched.is_some() {\n                    anyhow::bail!(\n                        \"Ambiguous MCP tool name '{prefixed_name}' matches more than one server/tool authority\"\n                    );\n                }\n                matched = Some((server.clone(), tool.name.clone()));\n            }\n        }\n        if let Some(matched) = matched {\n            return Ok(matched);\n        }\n\n        Err(anyhow::anyhow!(\"Unknown MCP tool name: {prefixed_name}\"))\n    }\n\n    /// Resolve an MCP tool through an exact advertised catalog. A configured\n    /// but lazy server may be connected and asked for `tools/list`; the\n    /// requested suffix is never treated as authority on its own.\n    async fn resolve_advertised_tool(&mut self, prefixed_name: &str) -> Result<McpToolRoute> {\n        Self::authorize_call(","sourceCodeStart":4438,"sourceCodeEnd":4474,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/mcp.rs#L4438-L4474","documentation":"After stripping mcp_, the resolved name matches tools on more than one authorized server; the ambiguity guard refuses to pick arbitrarily because the call could reach an unintended server with the same tool name.","triggerScenarios":"Thrown at crates/tui/src/mcp.rs:4456 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Disambiguate by using the fully server-prefixed tool name instead of the short form.","Disable one of the colliding servers/tools in config so the short name resolves uniquely."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}