Repository navigation
Allow tools to be disabled and thus hidden from mcp discovery - #447
Conversation
…den retrieve_tools test Address review feedback on PR smart-mcp-proxy#447: 1. handleListUpstreams previously fell back to live ListTools only when p.mainServer == nil (test/standalone). In production the getVisibleToolCount path uses the supervisor's StateView snapshot, which is empty during startup before the supervisor hydrates - so the UI would show "0 tools" for a freshly-connected server with healthy tools. Restored the live ListTools fallback in production too, filtered by isToolCallable so disabled tools still don't inflate the count. 2. handleRetrieveTools called auth.AuthContextFromContext(ctx) inside the per-result loop. Hoisted it (and the IsAdmin check) above the loop - it's a per-request value and the lookup is repeated work for every search result. 3. TestRetrieveTools_ExcludesDisabledToolsPreRanking previously silent-passed if the response had no "tools" field. The query ("context7 resolve library id") only matched the disabled context7 tool, so the enabled github tool wasn't a positive control - the test verified nothing once the disabled tool was filtered out. Rewrote both tools to share the same description so BM25 returns both, then asserted: - the enabled tool MUST appear (positive control catches an over- eager filter regression), - the disabled tool MUST NOT appear (negative control). Also dropped the silent early-return in favor of require.True on the tools field. Verification: - go test ./internal/server -count=1 -timeout 10m PASS (434s) - go vet ./... clean Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Reviewed and pushed Review summaryThe core mechanism — gating tool exposure on 1. Startup regression in
|
|
Thanks @JasonLandbridge! Merged. The TOOL_BLOCKED + isToolCallable centralization is a clean pattern - we'll be able to reuse it for the per-agent visibility work coming next. |
|
Thanks! |
…mcp-proxy#447) Closes smart-mcp-proxy#432 <img width="2188" height="602" alt="image" src="https://github.com/user-attachments/assets/8aef92a4-09de-4caa-acf0-24994c04c113" /> <img width="3281" height="742" alt="image" src="https://github.com/user-attachments/assets/7f445aa8-16f2-461d-8b99-173539b59cb3" /> <img width="3289" height="1483" alt="image" src="https://github.com/user-attachments/assets/a809983d-a61a-4b8c-b000-24da70ea9fd4" /> - treat disabled tools as non-callable/non-discoverable via centralized callable checks - filter disabled tools before retrieve_tools response construction - return TOOL_BLOCKED with clear message for direct calls to disabled tools - exclude disabled tools from server status health tool_count displays - add regression tests for callable predicate, discovery filtering, blocked call error, and re-enable visibility - go test ./internal/server -run 'TestIsToolCallable_DisabledTool|TestRetrieveTools_ExcludesDisabledToolsPreRanking|TestCallBlockedTool_ReturnsToolBlocked|TestReenableTool_VisibleAndCallable|TestHandleListUpstreams_FilteredForAgent' - security/admin introspection remains available via explicit quarantine/security endpoints - standard discovery and call planning no longer surfaces disabled tools
Closes #432


Summary
Validation
Notes