{"record":{"id":"0f425253b513f7e9","repo":"openai/codex","slug":"mcp-tool-arguments-must-be-a-json-object-got-oth","errorCode":null,"errorMessage":"MCP tool arguments must be a JSON object, got {other}","messagePattern":"MCP tool arguments must be a JSON object, got (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/rmcp-client/src/rmcp_client.rs","lineNumber":782,"sourceCode":"                .boxed()\n            })\n            .await?;\n        self.persist_oauth_tokens().await;\n        Ok(result)\n    }\n\n    pub async fn call_tool(\n        &self,\n        name: String,\n        arguments: Option<serde_json::Value>,\n        meta: Option<serde_json::Value>,\n        timeout: Option<Duration>,\n    ) -> Result<CallToolResult> {\n        self.refresh_oauth_if_needed().await?;\n        let arguments = match arguments {\n            Some(Value::Object(map)) => Some(map),\n            Some(other) => {\n                return Err(anyhow!(\n                    \"MCP tool arguments must be a JSON object, got {other}\"\n                ));\n            }\n            None => None,\n        };\n        let meta = match meta {\n            Some(Value::Object(map)) => Some(RequestMetaObject::from(map)),\n            Some(other) => {\n                return Err(anyhow!(\n                    \"MCP tool request _meta must be a JSON object, got {other}\"\n                ));\n            }\n            None => None,\n        };\n        let mut rmcp_params = CallToolRequestParams::new(name);\n        rmcp_params.arguments = arguments;\n        let requested_modern = self.protocol_mode == McpProtocolMode::V20260728;\n        let result = self","sourceCodeStart":764,"sourceCodeEnd":800,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/rmcp-client/src/rmcp_client.rs#L764-L800","documentation":"Validation guard in call_tool: the caller passed tool arguments as a non-object JSON value (string, array, number, etc.). MCP tool arguments must be a JSON object (map) of parameter names to values; the offending value is echoed in the message.","triggerScenarios":"Thrown at codex-rs/rmcp-client/src/rmcp_client.rs:782 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass arguments as a JSON object (serde_json::Value::Object) or None","Fix the caller serializing arguments to a JSON string instead of an object"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}