Expand description
locode-tools — the tool framework: the typed Tool contract, the Registry,
and the single Registry::dispatch door (host-agnostic; ADR-0003/0004/0008).
Tools are authored against concrete Args/Output types, with the wire JSON
Schema derived from Args. The registry erases them to Box<dyn DynTool>
at its boundary and routes every call — by the pack-assigned wire name — through
one dispatch function, which returns both the history tool_result and the
report record. No concrete tools, filesystem, or shell live here (those are the
grok pack over locode-host).
Structs§
- Dispatched
- The outcome of one
Registry::dispatch: both the history and report views, plus a fatal signal. - Registry
- A set of tools keyed by their model-facing wire names, plus the one
dispatchdoor every call funnels through (ADR-0008). - ToolCtx
- The context handed to a tool for one call.
- Tool
RunResult - The two faces of a successful tool call, produced by erasure.
- Tool
Spec - A provider-neutral tool spec: name + description + args JSON Schema.
Enums§
- Grammar
Syntax - The grammar language of a
ToolInputFormat::Freeformtool. - Tool
Error - How a tool call failed, split into exactly two recovery paths (ADR-0004).
- Tool
Input Format - How a tool’s input is specified: a JSON-schema function tool, or a freeform
tool whose raw-text input is constrained by a server-side grammar (OpenAI
Responses
customtools — codex’sapply_patch). Exactly one of the two — an enum, not optional fields, so invalid states are unrepresentable. - Tool
Kind - A canonical classification tag for a tool, used only to align comparable tools across harness packs for A/B analysis (ADR-0003) — it is not the wire name (that is assigned per-pack at registration) and not the Rust type name.
Constants§
- MODEL_
OUTPUT_ BUDGET - Default model-facing byte budget. Matches Grok’s shell output cap.
Traits§
- DynTool
- The object-safe, type-erased tool the registry stores.
- Tool
- A tool authored against concrete types; the wire schema is derived from
Tool::Args, never hand-written (ADR-0003). - Tool
Output - The model-facing rendering of a tool’s output.
Functions§
- truncate_
for_ model - Bound
textto roughlybudgetbytes for model consumption, keeping the head and tail and eliding the middle (middle-truncation, Codex-style) with a byte-count marker in the seam.