Expand description
The tool-visibility policy lives in lean_ctx::core::tool_visibility so
engine code outside the MCP server can read it; re-exported here for the
server’s own callers.
Structs§
- Candidate
Inputs - Inputs to
candidate_set. Avoids a long bool parameter list (#clippy::fn_params_excessive_bools). - Client
Quirks - Client-specific advertising quirks, resolved once per
tools/listfrom the MCPclientInfoname and the candidate set.
Enums§
- Candidate
Set - Which candidate pool
tools/liststarts from, before per-tool gates run.
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§
- advertised_
tool_ defs_ default - Computes the tool set this install advertises to a default client
(no client quirks, no role restriction, no workflow gate, static tool list),
including the live description compression. Offline counterpart of the
tools/listhandler fordoctor overhead/ContextOverhead::measure— kept next to the pure gates so measurement cannot drift from policy. “No quirks” is the worst case: a client without a native editor seesctx_patchtoo, so the reported overhead never understates. - candidate_
set - Decides the candidate pool. Single source of truth for the
tools/listhandler AND offline measurement (doctor overhead), so the advertised surface and the reported overhead can never drift apart. - category_
gate_ applies - Whether the lazy per-category gate should filter the advertised tool set.
- explicit_
profile - Whether the user explicitly pinned a tool profile (config key, custom tool
list, or env var) — the trigger for
CandidateSet::ProfileAuthoritative. - guidance_
profile - The tool set agent-facing guidance may name for
client_name: the MCPinstructionsand the injected rule files (#1849). It passes the same gates astools/list— the effective profile,disabled_tools(which folds inprefer_native_editor) and the client’s quirks — so the text never points the agent at a tool its session cannot call. - is_
tool_ visible - Decides whether a tool name should appear in
tools/list. - mark_
auto_ ctx_ tool_ used - Mark that the agent has invoked a ctx_* MCP tool in this session.
- narrow_
to_ surface - Pure core of
guidance_profile:profileminus every tool the surface withholds.Autois taken at its starting point (minimal) — guidance is written once per session and must not promise a tool before escalation. - needs_
invoker - Whether
INVOKERmust be force-added to the advertised set. - record_
auto_ turn - Increment the Auto-profile turn counter (call once per tools/list request).
- resolve_
auto_ profile - Resolve
ToolProfile::Autoto a concrete profile using session signals. Non-Auto profiles are returned as-is.