Skip to main content

Module mcp_deferred

Module mcp_deferred 

Expand description

Deferred MCP tool loading — stubs and activated-tool tracking.

Structs§

ActivatedToolSet
Per-conversation mutable state tracking which deferred tools have been activated (i.e. their full schemas have been fetched via tool_search). The agent loop consults this each iteration to decide which tool_specs to include in the LLM request.
DeferredMcpToolSet
Collection of all deferred MCP tool stubs discovered at startup. Provides keyword search for tool_search.
DeferredMcpToolStub
A lightweight stub representing a known-but-not-yet-loaded MCP tool. Contains only the prefixed name, a human-readable description, and enough information to construct the full McpToolWrapper on activation.

Functions§

build_deferred_tools_section
Build the <available-deferred-tools> section for the system prompt. Lists only tool names so the LLM knows what is available without consuming context window on full schemas. Includes an instruction block that tells the LLM to call tool_search to activate them.
build_deferred_tools_section_excluding
build_deferred_tools_section_filtered