Hmbown/CodeWhale · error

Ambiguous MCP tool name

Error message

Ambiguous MCP tool name '{prefixed_name}' matches more than one server/tool authority

What it means

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.

Solutions

  1. Disambiguate by using the fully server-prefixed tool name instead of the short form.
  2. Disable one of the colliding servers/tools in config so the short name resolves uniquely.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/mcp.rs:4456 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/4ce222924f345e41. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/mcp.rs:4456

            &serde_json::json!({}),
        )?;
        let Some(rest) = prefixed_name.strip_prefix("mcp_") else {
            anyhow::bail!("Invalid MCP tool name: {prefixed_name}");
        };

        let mut matched: Option<(String, String)> = None;
        for (server, connection) in &self.connections {
            if !self.server_allowed(server) || !connection.catalog_authorized() {
                continue;
            }
            for tool in connection.tools() {
                if !connection.config().is_tool_enabled(&tool.name)
                    || format!("{server}_{}", tool.name) != rest
                {
                    continue;
                }
                if matched.is_some() {
                    anyhow::bail!(
                        "Ambiguous MCP tool name '{prefixed_name}' matches more than one server/tool authority"
                    );
                }
                matched = Some((server.clone(), tool.name.clone()));
            }
        }
        if let Some(matched) = matched {
            return Ok(matched);
        }

        Err(anyhow::anyhow!("Unknown MCP tool name: {prefixed_name}"))
    }

    /// Resolve an MCP tool through an exact advertised catalog. A configured
    /// but lazy server may be connected and asked for `tools/list`; the
    /// requested suffix is never treated as authority on its own.
    async fn resolve_advertised_tool(&mut self, prefixed_name: &str) -> Result<McpToolRoute> {
        Self::authorize_call(

View on GitHub (pinned to 73e0f67d83)