Expand description
System-prompt catalog of activatable tools (progressive disclosure).
In progressive mode the model starts with a small core of tools and has to know that more exist before it will search for or activate them. This module renders a compact, one-line-per-tool listing of every activatable tool outside the session core, which the runtime appends to the system prompt.
Prompt-cache contract: the text is a pure function of the catalog at the moment it is rendered (sorted by tool id, no generation numbers, no “already active” markers), and the runtime freezes it per session, so an activation or a late tool registration never changes the cached prefix.
Descriptions come from third parties (MCP servers, extensions): they are sanitized (no control characters or newlines, provider tag dropped, first sentence only, clamped) and framed as data.
Constants§
- MAX_
LISTED - Maximum tools listed individually; the rest are counted per source.
- MAX_
LISTED_ BYTES - Maximum bytes of listed lines; the rest are counted per source.
- SUMMARY_
MAX_ CHARS - Maximum characters kept from one tool’s summary.
Functions§
- render
- Render the catalog of activatable tools that are not in
core, orNonewhen there are none.activatabledecides trust (the same checkactivate_toolsapplies);coreholds the session core’s tool ids. - sanitize_
summary - One clean line from a third-party description: control characters and
newlines removed, whitespace collapsed, a leading
[MCP:server]-style tag dropped, first sentence only, at mostSUMMARY_MAX_CHARScharacters.