feat(mcpcatalog): hide disable / reset_auth tools when no server is enabled#2840
Merged
Conversation
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The gating logic for disable_remote_mcp_server and reset_remote_mcp_server_auth is sound. The snapshot-based concurrency is the correct pattern here — the toolsChangedHandler notify mechanism ensures any transiently stale view self-corrects on the next turn, which is the intended design.
No actionable bugs found in the changed code.
rumpl
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Optimise the MCP catalog builtin tool's meta-surface:
disable_remote_mcp_serverandreset_remote_mcp_server_authnow only appear once at least one server is enabled. When the catalog has no enabled server, the LLM sees only the three useful actions (search,list,enable).Why
The two gated tools are no-ops when nothing is enabled — they just bloat the prompt and tempt the model to call them on an empty surface. Hiding them keeps the meta-surface minimal until the model has actually activated something.
Notes on concurrency
Tools()snapshots+ "t.enabled" +under+ "RLock" +and reads+ "len(enabled)" +on the local slice — no shared-state access after unlock.+ "handleEnable" +and+ "handleDisable" +already fire+ "toolsChangedHandler" +whenever the count flips, so the runtime re-enumerates and any stale view self-corrects on the next turn.Tests
+ "TestEnableDisableLifecycle" +strengthened to assert disable/reset are hidden initially.+ "TestToolsExposesEnabledServerTools" +extended to assert all five meta-tools (including+ "reset_auth" +) are visible once a server is enabled.+ "TestDisableAndResetAuthGatedOnEnabledServers" +covers the full hide → enable → show → disable → hide cycle, using a local httptest fake auth-required MCP server (no network, deterministic).+ "task lint" +and+ "task test" +are clean.