{"record":{"id":"dd21385dae75271c","repo":"zeroclaw-labs/zeroclaw","slug":"mcp-rpc-method-error","errorCode":null,"errorMessage":"MCP `{rpc_method}` error {}: {}","messagePattern":"MCP `(.+?)` error (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-tools/src/mcp_client.rs","lineNumber":782,"sourceCode":"        &self,\n        rpc_method: &str,\n        params: serde_json::Value,\n    ) -> Result<serde_json::Value> {\n        let tool_timeout = {\n            let inner = self.inner.lock().await;\n            inner\n                .config\n                .tool_timeout_secs\n                .unwrap_or(DEFAULT_TOOL_TIMEOUT_SECS)\n                .min(MAX_TOOL_TIMEOUT_SECS)\n        };\n        let operation = format!(\"`{rpc_method}`\");\n        let resp = self\n            .dispatch_rpc(rpc_method, params, tool_timeout, &operation)\n            .await?;\n\n        if let Some(err) = resp.error {\n            bail!(\"MCP `{rpc_method}` error {}: {}\", err.code, err.message);\n        }\n        let result = resp.result.unwrap_or(serde_json::Value::Null);\n        let server_name = self.inner.lock().await.config.name.clone();\n        check_result_is_error(&result, rpc_method, &server_name)?;\n        Ok(result)\n    }\n\n    /// `resources/list` — capability-gated.\n    pub async fn list_resources(&self, cursor: Option<String>) -> Result<McpResourcesListResult> {\n        {\n            let inner = self.inner.lock().await;\n            if !inner.capabilities.supports_resources() {\n                bail!(\n                    \"MCP server `{}` does not support resources\",\n                    inner.config.name\n                );\n            }\n        }","sourceCodeStart":764,"sourceCodeEnd":800,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-tools/src/mcp_client.rs#L764-L800","documentation":"dispatch_method sent a non-tool JSON-RPC method (resources/list, resources/read, prompts/list, prompts/get) and got a response with a top-level error object set. The message embeds the JSON-RPC code and server message, relaying a protocol-level rejection of that specific method call.","triggerScenarios":"Passing a stale cursor from a previous resources/list page; a resources/read URI the server does not recognize; prompts/get with an unknown prompt name; a server that declares a capability in initialize but fails the actual method (version drift, auth expiry mid-session).","commonSituations":"Cursors persisted across sessions after the server changed; URIs copied from a different server; prompt names renamed upstream; tokens expiring between capability discovery and the read.","solutions":["Map the embedded code: -32601 method not found, -32602 invalid params (bad cursor or URI), -32603 server internal","Use cursors only within a single pagination sequence; refetch page one on -32602","Verify the URI or prompt name against what list_resources / list_prompts returned from that same server","For -32603 or auth-shaped errors, reconnect and retry once"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_jsonrpc_method_error(err: &anyhow::Error) -> bool {\n    let s = err.to_string();\n    s.contains(\"MCP `resources/\") || s.contains(\"MCP `prompts/\") || s.contains(\"error -3\")\n}","tryCatchPattern":"Catch per method call: -32602 with a cursor -> restart pagination from page one; unknown URI/prompt -> drop the stale reference; -32603 or auth-shaped messages -> reconnect once and retry.","preventionTips":["Keep cursors scoped to a single pagination run","Verify URIs and prompt names against list_resources/list_prompts from the same server and session","Reconnect on long-lived sessions so mid-session auth expiry surfaces as a clean retry"],"tags":["mcp","json-rpc","resources","prompts","error-code"],"backgroundTag":"rpc-error-response","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}