Hmbown/CodeWhale · error

Invalid MCP tool name

Error message

Invalid MCP tool name: {prefixed_name}

What it means

parse_prefixed_name requires the mcp_ prefix; a tool name without it cannot identify an MCP server/tool pair and is rejected before any server resolution, so built-in tools must not be routed through this path.

Solutions

  1. Call MCP tools with their prefixed form 'mcp_<server>_<tool>' (or '<server>__<tool>' per project convention).
  2. Check the tool name for typos; unprefixed names must strip the 'mcp_' marker.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/mcp.rs:4441 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/2c095c9738e784d3. Report an issue: GitHub.

Appendix: source

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

            .any(|prompt| prompt.name == prompt_name)
        {
            anyhow::bail!(
                "MCP prompt '{prompt_name}' was not advertised by server '{server_name}'"
            );
        }
        let timeout = conn.config().effective_execute_timeout(&global_timeouts);
        conn.get_prompt(prompt_name, arguments, timeout).await
    }

    /// Parse a prefixed name into (server_name, tool_name)
    pub(crate) fn parse_prefixed_name(&self, prefixed_name: &str) -> Result<(String, String)> {
        Self::authorize_call(
            &self.disallowed_tools,
            prefixed_name,
            &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"
                    );
                }

View on GitHub (pinned to 73e0f67d83)