{"record":{"id":"df33a588faebcbe6","repo":"Kuberwastaken/claurst","slug":"no-mcp-server-found-for-tool-connected-serve","errorCode":null,"errorMessage":"No MCP server found for tool '{}'. Connected servers: [{}]","messagePattern":"No MCP server found for tool '(.+?)'\\. Connected servers: \\[(.+?)\\]","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-rust/crates/mcp/src/lib.rs","lineNumber":1049,"sourceCode":"        }\r\n        defs\r\n    }\r\n\r\n    /// Execute a tool call, routing to the correct server.\r\n    /// Tool name format: `<server_name>_<tool_name>`.\r\n    pub async fn call_tool(\r\n        &self,\r\n        prefixed_name: &str,\r\n        arguments: Option<Value>,\r\n    ) -> anyhow::Result<CallToolResult> {\r\n        // Find the server name by matching prefix\r\n        for (server_name, client) in &self.clients {\r\n            let prefix = format!(\"{}_\", server_name);\r\n            if let Some(tool_name) = prefixed_name.strip_prefix(&prefix) {\r\n                return client.call_tool(tool_name, arguments).await;\r\n            }\r\n        }\r\n        Err(anyhow::anyhow!(\r\n            \"No MCP server found for tool '{}'. Connected servers: [{}]\",\r\n            prefixed_name,\r\n            self.clients.keys().cloned().collect::<Vec<_>>().join(\", \")\r\n        ))\r\n    }\r\n\r\n    /// Number of connected servers.\r\n    pub fn server_count(&self) -> usize {\r\n        self.clients.len()\r\n    }\r\n\r\n    /// Get server instructions (from initialize response).\r\n    pub fn server_instructions(&self) -> Vec<(String, String)> {\r\n        self.clients\r\n            .iter()\r\n            .filter_map(|(name, client)| {\r\n                client.instructions.as_ref().map(|instr| (name.clone(), instr.clone()))\r\n            })\r","sourceCodeStart":1031,"sourceCodeEnd":1067,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/mcp/src/lib.rs#L1031-L1067","documentation":"The MCP aggregator exposes tools under a `<server_name>_<tool_name>` prefix. When call_prefixed_tool (or similar) receives a prefixed name whose prefix matches no connected server, it throws this error listing the currently connected servers.","triggerScenarios":"Invoking a tool whose prefix doesn't match any entry in self.clients: server disconnected, tool name referenced with the wrong server prefix, or a cached/stale tool name after the server list changed.","commonSituations":"MCP server failed to connect at startup so its tools are gone but cached UI still lists them; renamed server in config without updating tool references; nested underscores confusing which part is the prefix; connecting a server that exposes tools with the same prefix.","solutions":["Check the \"Connected servers\" list in the message — the server you need isn't connected; fix its config and reconnect","Use the correct `<server>_<tool>` prefix exactly as the connected server is named","Refresh the tool list after (re)connecting servers so stale tool names aren't invoked","Watch for ambiguous prefix collisions: the first matching server prefix wins, so avoid server names that are prefixes of each other"],"exampleFix":"// before\ncall(\"filesytem_read_file\", ...)   // typo'd server name\n// after\ncall(\"filesystem_read_file\", ...)","handlingStrategy":"validation","validationCode":"fn server_for_tool<'a>(clients: &'a HashMap<String, McpClient>, tool: &str) -> Option<&'a String> {\n    clients.keys().find(|s| tool.starts_with(&format!(\"{s}_\")))\n}","typeGuard":null,"tryCatchPattern":"match call_prefixed_tool(prefixed, args).await {\n    Err(e) if e.to_string().starts_with(\"No MCP server found for tool\") => {\n        refresh_tool_registry().await; // reconnect and rebuild tool list\n    }\n    r => r?,\n}","preventionTips":["Rebuild cached tool lists whenever servers connect/disconnect","Avoid server names that are prefixes of one another","Validate tool names against the live registry before dispatch"],"tags":["mcp","tool-routing","naming"],"backgroundTag":"resource-not-found","analyzedSha":"b0637c97ec34144387cbf2f74f65df6d16a6cef1","analyzedAt":"2026-09-10T00:24:58.650Z","contentChangedAt":"2026-09-10T00:24:58.650Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}