Skip to content

feat: add ROUTER_IGNORE_TOOL_IDS for tool-level filtering - #14

Closed
effortprogrammer wants to merge 2 commits into
mainfrom
fix/router-ignore-tool-ids
Closed

feat: add ROUTER_IGNORE_TOOL_IDS for tool-level filtering#14
effortprogrammer wants to merge 2 commits into
mainfrom
fix/router-ignore-tool-ids

Conversation

@effortprogrammer

Copy link
Copy Markdown
Owner

Problem

grep_app MCP's searchGitHub tool searches all of GitHub instead of the local codebase. The BM25 router picks it up on keywords like "search", "code", "find" — returning results from unrelated repos (actix-web-demo, VictoriaMetrics, etc.).

Users could only block the entire server via ROUTER_IGNORE_IDS=grep_app, losing other useful tools from the same server.

Additionally, reenableOhMyOpencodeMcps() was force-re-enabling built-in MCPs that users had intentionally disabled.

Solution

1. New env var: ROUTER_IGNORE_TOOL_IDS

  • Format: ROUTER_IGNORE_TOOL_IDS=serverId:toolName,serverId2:toolName2
  • Example: ROUTER_IGNORE_TOOL_IDS=grep_app:searchGitHub
  • Filters tools at registration time — they never enter the BM25 index
  • Other tools from the same server remain available

2. Remove reenableOhMyOpencodeMcps postWriteHook

  • Was overriding user config by force-re-enabling built-in MCPs
  • User settings should always be respected

Files Changed

  • router.py — Core filtering in sync_from_tool_definitions
  • hub.py — Stores and passes ignore_tool_ids through the chain
  • opencode_gateway_server.py — Parses env var
  • router_mcp_server.py — Parses env var (standalone mode)
  • index.ts — Removes reenableOhMyOpencodeMcps hook

Adds support for blocking specific tools from specific MCP servers
without disabling the entire server.

Format: ROUTER_IGNORE_TOOL_IDS=serverId:toolName,serverId2:toolName2
Example: ROUTER_IGNORE_TOOL_IDS=grep_app:searchGitHub

Also removes reenableOhMyOpencodeMcps postWriteHook that was
force-re-enabling built-in MCPs the user had intentionally disabled.

Fixes: grep_app searchGitHub routing to unrelated GitHub repos
…onfig.py

The Python side had the same bug — force-re-enabling built-in MCPs
(context7, grep_app, websearch) that users disabled via oh-my-opencode.
@effortprogrammer
effortprogrammer force-pushed the fix/router-ignore-tool-ids branch from 4b8b114 to a07feb4 Compare March 5, 2026 14:09
@effortprogrammer

Copy link
Copy Markdown
Owner Author

Closing in favor of PR #15 (hybrid search) — rule-based blocklist doesn't scale. Will verify hybrid search properly handles tool disambiguation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant