Skip to main content

Module dynamic_tools

Module dynamic_tools 

Source
Expand description

The name logic lives in lean_ctx::core::dynamic_tools; this module keeps the helpers that resolve a call through ctx_call/ctx to its inner tool.

Structs§

DynamicToolState
RemovedTool
A tool that was removed: folded into a primary tool (#509) or retired without a successor (focus release, 2026-10). Only the name survives, so a call from an older agent prompt or config gets the way forward instead of a bare “Unknown tool” (docs/migration/focus-2026-10.md).

Enums§

ToolCategory

Constants§

HIVE_TOOLS
Hive MCP tools, gated with the connector (see crate::core::hive_gate::HIVE_TOOLS). Hive MCP tools. They ship with the connector but follow its release switch (available_locally, owner 28.10.): while it is off they are in no tool list and every call answers TOOL_NOT_AVAILABLE.
INTERNAL_HOST_TOOLS
Host-integration hooks: called by a host extension (the Claude Code mod’s $.mcp.call, through the listed ctx_call since hosts may refuse unlisted tools, #2089), never by an agent. Advertising them would only spend prompt tokens on a tool the model must not use.
LOCAL_COLLABORATION_COMPATIBILITY_TOOLS
Local collaboration substrate that remains callable for installed users but is excluded from every public MCP tool surface.

Functions§

categorize_tool
global
init_all_enabled
init_from_config
Initializes the global state from user config (env var > config.toml > default). Call once during server startup after config is loaded. If the global was already initialized (e.g. by a concurrent global() call), applies the categories to the existing state instead.
is_local_collaboration_compatibility_tool
Whether a registered tool is retained only for local compatibility and must never be advertised from a public tool-definition path.
is_publicly_advertised_tool
Whether a registered tool belongs on a public MCP tool surface.
is_readonly_tool
is_withheld_hive_tool
Whether name is a Hive tool withheld by the release switch.
removed_tool
The successor and migration hint for a removed tool name, else None.
removed_tool_message
The error text for a call to a removed tool. Stable per name (no timestamps/counters) so provider-side prompt caching stays byte-stable (#498).
targets_internal_host_tool
Whether a call — direct, or through ctx_call/ctx — targets an internal host hook. A host replaces a native tool’s output with the hook’s success body, so every gate refusal on such a call must read as an error: then the host keeps the original output instead of a block message (#2089).
withheld_hive_tool_refusal
The fixed answer for a call — direct, or through ctx_call/ctx — to a withheld Hive tool, else None. Stable text (#498).