Skip to main content

Module compact

Module compact 

Source
Expand description

Tool schema compaction utilities for session tool catalog.

Constants§

MCP_TOOL_DESCRIPTION_MAX_LEN
Default max description length for MCP tool descriptions. MCP tools from external servers can have arbitrarily long descriptions; capping them prevents token inflation. The cap applies in every mode and never raises a mode’s own limit.
MINIMAL_DESCRIPTION_MAX_CHARS
Minimal mode sends only the first sentence of a tool description, capped at this many characters, and strips parameter descriptions.
PROGRESSIVE_DESCRIPTION_MAX_CHARS
Progressive mode (the default) keeps whole leading sentences of a tool description up to this many characters. Builtin descriptions are limited to 1500 characters by the description contract test and currently fit well under this cap, so they reach the model intact; only unusually long tails are dropped, at a sentence boundary.
PROGRESSIVE_PARAMETER_DESCRIPTION_MAX_CHARS
Progressive mode keeps parameter descriptions, trimming each one to whole leading sentences within this many characters.

Functions§

compact_parameters
Project a parameter schema for the given documentation mode.
compact_tool_description
Project a tool description for the given documentation mode.
default_parameter_schema
remove_schema_descriptions