{"record":{"id":"ac71d01ddba32dfd","repo":"Hmbown/CodeWhale","slug":"tool-tool-name-on-mcp-server-server-name-i","errorCode":null,"errorMessage":"tool '{tool_name}' on MCP server '{server_name}' is blocked by the tool filter","messagePattern":"tool '(.+?)' on MCP server '(.+?)' is blocked by the tool filter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mcp/src/lib.rs","lineNumber":452,"sourceCode":"            }\n        }\n        Ok(out)\n    }\n\n    /// Call a tool on a specific server by name.\n    ///\n    /// The server's [`ToolFilter`] is enforced on invocation, not just at\n    /// listing time: a denied (or not-allowed) tool cannot be executed by\n    /// addressing the server directly, whether by bare or qualified name.\n    pub fn call_tool(&self, server_name: &str, tool_name: &str, arguments: Value) -> Result<Value> {\n        let client = self\n            .clients\n            .get(server_name)\n            .with_context(|| format!(\"MCP server '{server_name}' not available\"))?;\n        if let Some((_, filter)) = self.configs.get(server_name)\n            && !allowed_by_filter(tool_name, filter)\n        {\n            bail!(\"tool '{tool_name}' on MCP server '{server_name}' is blocked by the tool filter\");\n        }\n        client.call_tool(tool_name, arguments)\n    }\n\n    /// Call a tool using its fully qualified name (e.g., `mcp__server__tool`).\n    pub fn call_qualified_tool(\n        &self,\n        qualified_tool_name: &str,\n        arguments: Value,\n    ) -> Result<Value> {\n        let parsed = parse_qualified_tool_name(qualified_tool_name)\n            .with_context(|| format!(\"invalid qualified MCP tool name: {qualified_tool_name}\"));\n\n        // An exact registration is the answer. Whatever the tool returns —\n        // including an error — is returned as-is: falling through to the scan\n        // below on a *call* failure would re-execute the same tool, and for a\n        // file write, a commit, or a paid API call that second invocation is a\n        // second real side effect. Only a failed *lookup* falls through.","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/mcp/src/lib.rs#L434-L470","documentation":"This error is thrown by McpManager::call_tool when the requested tool name exists on the server but is rejected by a per-server tool filter configured in `configs`. The filter acts as an allow/deny list; `allowed_by_filter` returns false and the call fails closed instead of reaching the MCP client. It prevents calls to tools the operator deliberately excluded.","triggerScenarios":"Calling McpManager::call_tool(server_name, tool_name, arguments) for a server that has an entry in self.configs whose filter does not allow tool_name. Also occurs indirectly through call_qualified_tool, which delegates to call_tool.","commonSituations":"Config file lists an allow/deny filter for the MCP server but the application later tries to invoke a tool outside it; a model hallucinates a tool name that is filtered; filter patterns were written after tools were renamed; tests like manager_call_tool_enforces_deny_filter exercise this deliberately.","solutions":["Check the tool filter configured for that server (self.configs / manager config) and add the tool to the allow list or remove it from the deny list.","Verify the exact tool name spelling matches what the server advertises via list_tools; fix the filter or the call site to use the correct name.","If the tool should genuinely be unavailable, change the calling code to stop requesting it (skip or pick another tool)."],"exampleFix":"// before (config)\nfilters: { \"github\": deny: [\"*write*\"] }\nmanager.call_tool(\"github\", \"create_issue\", args)  // blocked\n// after\nfilters: { \"github\": deny: [\"delete_repo\"] }\nmanager.call_tool(\"github\", \"create_issue\", args)","handlingStrategy":"validation","validationCode":"fn tool_allowed(manager: &McpManager, server: &str, tool: &str) -> bool {\n    manager.configs.get(server)\n        .map(|(_, filter)| allowed_by_filter(tool, filter))\n        .unwrap_or(true)\n}\n// check before calling: if !tool_allowed(&manager, \"github\", \"create_issue\") { skip }","typeGuard":null,"tryCatchPattern":"match manager.call_tool(server, tool, args) {\n    Err(e) if e.to_string().contains(\"blocked by the tool filter\") => {\n        tracing::warn!(\"tool {tool} filtered on {server}; skipping\");\n    }\n    other => other?,\n}","preventionTips":["Keep tool filters and calling code in the same config review; diff filter lists against the tools your app invokes.","Enumerate the server's tools via list_tools and assert every needed tool passes allowed_by_filter at startup.","Fail loudly at config load if a required tool is filtered, rather than at call time."],"tags":["mcp","tool-filter","access-control"],"backgroundTag":"permission-denied","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}