Skip to main content

Module tool_visibility

Module tool_visibility 

Source
Expand description

Pure tool-visibility policy for the MCP tools/list response.

Extracted from the (async, server-bound) list_tools handler so the policy is unit-testable in isolation. The handler resolves the candidate set (lazy-core vs profile-authoritative vs full registry) and the per-call gates (role, workflow), then defers to these helpers for the stable rules:

  • Internal/meta tools are never advertised.
  • The active profile, disabled_tools, and the Zed ctx_edit quirk filter the candidates.
  • The universal invoker (ctx_call) is force-advertised in non-full mode so tools hidden by lazy/profile filtering stay reachable.

Constants§

INVOKER
The universal invoker tool name. A static-list MCP client can call any registered tool through it, even when that tool isn’t advertised.

Functions§

category_gate_applies
Whether the lazy per-category gate should filter the advertised tool set.
is_tool_visible
Decides whether a tool name should appear in tools/list.
needs_invoker
Whether INVOKER must be force-added to the advertised set.