Skip to content

MCP tool blocking not working - agents can still see and access disabled tools #3756

@SuperSonnix71

Description

@SuperSonnix71

MCP tool blocking not working - agents can still see and access disabled tools

Hey! I'm trying to disable specific MCP tools for an agent, but the agent can still see and try to use those tools even though they're disabled in the config.

What I tried

Agent configuration with MCP tool blocking:

{
  "agent": {
    "my-agent": {
      "model": "ollama/my-model",
      "tools": {
        "write": true,
        "edit": true,
        "bash": true,
        "mcp__my-server__*": false  // ← Trying to block all tools from an MCP server
      }
    }
  }
}

Expected behavior

The agent should NOT be able to see or access any MCP tools that are set to false.

Actual behavior

  1. The model can still see all the MCP tools in its function list
  2. The model tries to call these disabled tools
  3. The model gets confused because it sees the tools but they're supposed to be disabled

Example output from model:

The only functions provided are the mcp__* ones. 
The instructions say they are disabled.
Given restrictions, we cannot perform the task.

The model is clearly seeing the MCP tools in its available functions list, even though they're configured as false.

Environment

  • OpenCode version: Latest
  • MCP servers: Multiple (both local and remote)
  • Models: Ollama models via remote endpoint

Related

Found issue #1320 which mentioned disabled tools still being accessible, but it was closed. The tool blocking mechanism doesn't seem to work for MCP tools.

Expected vs Actual

Expected: Tool restrictions should completely hide the tools from the model's function list

Actual: MCP tools are visible to the model even when disabled, causing confusion and failed tool calls

Is this a known limitation? Any workaround?

Thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions