Expand description
ToolCatalog — all locally known capabilities (spec §7.1, Task 14).
The catalog is a passive inventory integrated into super::ToolRegistry:
every registry construction and mutation path (initial construction,
subagent variants, dynamic registration, replacement, extension merge,
disable) keeps exactly one truthful catalog alongside the exposed schema
without changing what is exposed or executable. The registry remains the
active behavior projection until later tasks introduce DiscoveryIndex,
SessionToolSet, and ExecutionGate.
Insertion invariants (spec §4.2):
- no implementation is constructed (factories are stored, never invoked);
- no process is started and no network is touched;
- no extension handler or MCP connection method is called;
- no schema is exposed to the model;
- no execution grant is issued.
Mutation invariants:
- every successful mutation advances the generation by checked (never saturating) arithmetic — a mutation cannot succeed without a new generation, so stale activation grants can never keep validating;
- duplicate and no-op failures do not advance the generation.
Structs§
- Capability
Record - One locally known capability. Construction is pure: it computes the deterministic schema digest and bounds the compact descriptor, but never invokes the implementation factory.
- Catalog
Generation - Monotonic catalog mutation counter. Every catalog mutation advances the generation so stale activations can be detected and invalidated.
- Catalog
Generation Overflow - Typed failure for exhausting the generation counter. Mutations observing this must fail closed: no mutation may succeed without a new generation.
- Discovery
Entry - One compact, serializable discovery descriptor. By construction it holds no schema locator, no factory, no extension/MCP handler or process data, and no raw unbounded source strings — only the stable id, bounded summary/tags (already bounded at catalog time), a source-class label, and digest metadata.
- Discovery
Index - Bounded searchable snapshot of catalog compact descriptors (spec §7.1).
- Discovery
Query - A validated, bounded, case-folded discovery query. Parse-at-boundary: empty (or whitespace-only), oversized, and control-character-bearing input fails typed before any search runs.
- Schema
Digest - Deterministic SHA-256 digest (lowercase hex) of a tool’s full JSON schema.
- Search
Limits - Validated positive, capped search budgets. The byte budget bounds the
exact compact-JSON serialization of the returned hit collection as an
array (entries plus
[/]and comma overhead), so a caller can rely onserde_json::to_vec(results.hits())never exceeding it. - Search
Results - Deterministic search outcome.
truncatedis true whenever any matching entry was withheld by the count or byte budget, so callers never mistake a bounded result for the complete one. - Session
Activation Grant - An exact, session-scoped activation of one catalog capability, pinned to the catalog generation and schema digest it was granted against.
- Tool
Catalog - Inventory of all locally known capabilities, keyed by stable
ToolIdin deterministic order, with a generation that advances on every mutation. - ToolId
- Stable, validated capability identity of the form
namespace:name(e.g.builtin:bash,mcp.server-1:list_issues).
Enums§
- Capability
Source - Where a capability comes from, carrying the exact runtime identities (extension/plugin/server ids and per-source tool names). Drives the ID namespace and, later, per-source permission policy.
- Catalog
Error - Typed catalog mutation failures. All fail closed without advancing the catalog generation or partially applying the mutation.
- Discovery
Index Error - Typed failure for building a
DiscoveryIndex. - Discovery
Query Error - Typed failure for boundary parsing of a
DiscoveryQuery. - Schema
Locator - Where the full JSON schema for a capability lives. The catalog may hold the schema locally, but never exposes it to the model.
- Search
Limits Error - Typed failure for constructing
SearchLimits. Zero budgets would make every search vacuous; sub-minimum byte budgets could not even hold the empty serialized result collection; over-cap budgets would defeat the bound. - Source
Class - Serializable source-class label. A label only — no raw runtime identity strings, handlers, or process data.
- Tool
Effect - Conservative tool effect classes (Task 24, spec §8.2). Declared by the
implementation, recorded in the catalog at registration, and consumed
by the stream scheduler: only
ReadOnly(or proven non-conflicting keyed writes) run concurrently; everything else serializes. Unknown/ dynamic tools default toNonIdempotent— the safest class. - Tool
IdError - Typed failure for boundary parsing of
ToolId. - Trust
Provenance - Permission/trust provenance recorded at catalog time. Evaluated (not merely trusted) by the future execution gate.
Constants§
- QUERY_
MAX_ BYTES - Maximum UTF-8 byte length of a discovery query.
- SEARCH_
MAX_ RESULTS_ CAP - Hard cap on the per-search result count budget.
- SEARCH_
MAX_ RESULT_ BYTES_ CAP - Hard cap on the per-search serialized byte budget (64 KiB).
- SEARCH_
MIN_ RESULT_ BYTES - Minimum per-search serialized byte budget: the empty serialized result
collection (
[]) is 2 bytes, so no smaller budget can be honest.
Type Aliases§
- Tool
Factory - Deferred implementation constructor. Stored at insertion, invoked only by explicit later acquisition (execution-gate territory, not catalog).