{"record":{"id":"c9850fe2b7882361","repo":"Kuberwastaken/claurst","slug":"mcp-server-tool-call-failed","errorCode":null,"errorMessage":"MCP server '{}': tool '{}' call failed: {}","messagePattern":"MCP server '(.+?)': tool '(.+?)' call failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-rust/crates/mcp/src/lib.rs","lineNumber":686,"sourceCode":"        /// already have env vars expanded via `expand_server_config`.\r\n        pub async fn connect_stdio(config: &McpServerConfig) -> anyhow::Result<Self> {\r\n            let backend = crate::rmcp_backend::RmcpClientBackend::connect_stdio(config).await?;\r\n            Ok(Self::from_backend(Arc::new(backend)))\r\n        }\r\n\r\n        // ---- High-level API -----------------------------------------------\r\n\r\n        pub async fn list_tools(&self) -> anyhow::Result<Vec<McpTool>> {\r\n            self.backend()?.list_tools().await\r\n        }\r\n\r\n        pub async fn call_tool(\r\n            &self,\r\n            name: &str,\r\n            arguments: Option<Value>,\r\n        ) -> anyhow::Result<CallToolResult> {\r\n            self.backend()?.call_tool(name, arguments).await.map_err(|e| {\r\n                anyhow::anyhow!(\r\n                    \"MCP server '{}': tool '{}' call failed: {}\",\r\n                    self.server_name,\r\n                    name,\r\n                    e\r\n                )\r\n            })\r\n        }\r\n\r\n        pub async fn list_resources(&self) -> anyhow::Result<Vec<McpResource>> {\r\n            let mut resources = self.backend()?.list_resources().await?;\r\n            apply_resource_templates(&mut resources);\r\n            Ok(resources)\r\n        }\r\n\r\n        pub async fn read_resource(&self, uri: &str) -> anyhow::Result<ResourceContents> {\r\n            self.backend()?.read_resource(uri).await\r\n        }\r\n\r","sourceCodeStart":668,"sourceCodeEnd":704,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/mcp/src/lib.rs#L668-L704","documentation":"McpClient::call_tool forwards a tools/call to the server backend and wraps any backend error with the server name and tool name for context. The trailing `{}` contains the underlying rmcp/transport error, so the root cause (JSON-RPC error, timeout, connection drop, tool returning is_error) is in the wrapped cause.","triggerScenarios":"Calling call_tool(name, arguments) on a connected MCP client where the server rejects or fails the call: unknown tool on that server, invalid arguments schema, server-side exception, timeout, or connection lost mid-call.","commonSituations":"Wrong tool arguments not matching the server's inputSchema; tool execution crashed on the server; MCP server hung and the request timed out; connection dropped after a restart.","solutions":["Read the wrapped cause in the message to identify the concrete failure","Validate arguments against the tool's inputSchema (from tools/list) before calling","Confirm the tool name exists on that server via tools/list","Retry the call if the cause is a timeout/connection error; restart the server if it crashed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match client.call_tool(name, args).await {\n    Err(e) if e.to_string().contains(\"call failed\") => {\n        eprintln!(\"tool {name} failed: {e:#}\"); // inspect full cause chain\n    }\n    r => r?,\n}","preventionTips":["Fetch tools/list and validate arguments against inputSchema before calling","Add timeouts and one retry for transient transport causes","Re-list tools after server restarts to avoid stale names"],"tags":["mcp","rpc","tool-call"],"backgroundTag":"api-error-response","analyzedSha":"b0637c97ec34144387cbf2f74f65df6d16a6cef1","analyzedAt":"2026-09-10T00:24:58.650Z","contentChangedAt":"2026-09-10T00:24:58.650Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}