Skip to main content

Module tool_class

Module tool_class 

Source
Expand description

The one place a tool’s class is written, and the report that stands in for a class an operator did not load (#664). The one place a tool’s class is written, and the report that stands in for a class an operator did not load.

§Why classes at all

Every advertised tool costs tokens on every turn, whether or not the session could ever reach it. Measured on the surface this module classifies, security and sandbox are 51% of the description mass and are the two groups a code-navigation session never touches — so a session that only wants to read code pays roughly half its tool budget to advertise sandbox_clear, which is also the only tool on the surface that changes anything.

[crate::mcp::restrict] already resolves an operator’s list of tool names (issue #584). A class is that same mechanism with a name a person can actually type: --tools query,quality rather than ten names that go stale the moment a tool is added. Narrowing stays opt-in — the default advertises every class, so a server nobody configured behaves exactly as it did.

§Why a class must stay discoverable

A withheld class is invisible from the client side, and an invisible tool and an impossible one look identical to a model: asked about analyzer findings on a query-only server it would answer “Roteiro cannot do that”, which is false. [CLASS_INDEX_TOOL] is the fix and is why it is never withheld — it names every class, says which are loaded here, and costs a fraction of the prose it stands in for. The answer becomes “not loaded in this session, and here is the flag that loads it”.

§The taxonomy is total

Every tool belongs to exactly one class, and every_tool_has_exactly_one_class in [crate::mcp] fails if a tool is added to the surface and not to a class — which would otherwise make it unreachable through the class aliases while remaining reachable by name, a surface with two disagreeing halves.

Constants§

CLASSES
Each class and the tools it names, in the order a reader meets them.
CLASS_INDEX_TOOL
The tool that names the classes, and the one tool belonging to none of them.

Functions§

class_names
Every class name, for an error message that has to list them.
class_of
The class tool belongs to, or None for CLASS_INDEX_TOOL and for a name this taxonomy does not carry.
report
The document CLASS_INDEX_TOOL returns: every class, every tool in it, and what each one’s presence is here.
tools_in
The tools class names, or None for a word that is not a class.