Browse the documentation
Contract: tool identity
Status: specified
; parsing and validation areimplemented in src/tool-id.mjs.
The grammar
tool-id = domain "." ( resource "." )? [ sub "." ] verb
segment = [a-z] [a-z0-9-]*
- Two to four segments. The first segment is the
domain; the last is theverb; between them, at most oneresourceand onesub, in that order. - Lowercase letters, digits, and hyphens only. No uppercase, no underscores, no dots inside a segment.
vcs.file.read
vcs.repo.read
docs.file.metadata.read
edge.zone.read
telemetry.search
memory.context.read
ingest.job.create
ingest.job.cancel
compute.rows.verify
What an ID never carries
A tool ID is neutral by construction. It never contains:
- a vendor, product, or brand name — vendor identity lives in connector binding,
- a hostname, address, port, container, cluster, or environment name,
- a persona or character name,
- an implementation detail (protocol, SDK, client library, or method chain).
An ID states what the tool does, in domain terms. The registry entry carries the rest.
Registry entry
Each admitted tool is registered with:
| Field | Meaning |
|---|---|
toolId |
the neutral ID (vcs.file.read) |
connector |
the binding that actually performs it (carries the vendor identity) |
effect |
read | write | destructive | credential |
realm |
the data scope the tool may touch |
thirdPartyEgress |
true when the effect leaves the owner’s systems |
ownerGate |
true when the effect pauses the run for an owner decision |
inputSchema |
the validated argument shape |
outputSchema |
optional return value schema checked by checkSchema |
legacyNames |
read-only aliases kept for migration; never new work |
rollback |
optional rollback declaration (below); absent means unsupported |
Tool input and output schemas
checkSchema(schema) checks a closed, zero-dependency subset. A schema is a data
object. It can be empty or use these keywords:
| Keywords | Allowed values |
|---|---|
type |
object, array, string, number, integer, boolean, or null |
properties |
An object mapping property names to nested schemas |
required |
An array of non-empty property names |
additionalProperties |
false when present |
items |
One nested schema for every array element |
maxItems, minLength, maxLength |
Non-negative safe integers |
enum |
A non-empty array of JSON primitive literals |
minimum, maximum |
Finite numbers |
Unknown keywords and cyclic schema objects fail. validateValue(schema, value)
checks the schema first and applies its declared constraints to the value. Bounds
are inclusive and string lengths count Unicode code points. Object constraints
use own properties. A closed object refuses names absent from properties.
Both functions return a frozen { ok, errors } with frozen { path, reason }
entries. Paths are JSON Pointers with an empty string at the root. Schema errors
locate the schema field. Value errors locate the input or output field. Reasons
describe the violated constraint without repeating rejected values.
isWellFormedRegistryEntry and checkRegistry apply checkSchema when a registry
entry supplies outputSchema. Entries that omit it retain their previous shape
checks. A consumer can call validateValue before dispatch or before returning
a declared output.
Rollback posture
A registry entry may declare how its effects can be undone:
rollback: { posture, description?, compensatingTool? }
posture |
Meaning |
|---|---|
unsupported |
nothing can be rolled back; the default, and the honest answer for reads |
compensating_action |
another registered tool undoes the effect; compensatingTool names it |
restore_snapshot |
the effect is undone by restoring a prior snapshot |
manual_recovery_required |
undoing the effect needs an owner’s hands |
Rules:
- A declaration, not an executor. Seed checks the posture. It never runs a rollback, and no posture makes an effect safe to repeat on restart (see run-model.md, rule 3).
compensatingToolis required forcompensating_action, must be a well-formed tool ID, and is refused on any other posture. A tool may name itself.- Unknown fields inside
rollbackare refused.
Registry check
checkRegistry(entries) checks a set of entries together: every entry is well formed,
each toolId is registered once, and every compensatingTool is itself a registered
toolId. Each error is prefixed with the entry’s tool ID, or #<index> when the entry
has none. This is validation over a list the caller holds. The registry service that
publishes and serves entries is stage 3.2 and stays specified.
Caller admission
admitCaller(registry, { callerId, command }) in src/admission.mjs decides whether a
caller may run a command, over a registry the caller holds:
{ callers: [{ id, enabled, allowedTools: [toolId, ...] }],
commands: [{ command: [segment, ...], toolId }] }
It fails closed. Each denial returns { admitted: false, code, reason }:
code |
When |
|---|---|
registry-unavailable |
no registry, a registry without both lists, a caller entry without an id, or a caller id registered twice |
caller-unknown |
the call has no caller id, or the id is not registered |
caller-disabled |
the caller is not enabled: true (a missing flag is not a yes) |
command-unmapped |
no entry matches every segment of the command, or the entry’s toolId is not well formed |
tool-not-allowed |
the mapped tool is not on the caller’s allowedTools |
An admitted call returns { admitted: true, callerId, toolId }. Decisions are frozen.
This is a check over a list, not the registry service of stage 3.2.
Registry documents
checkRegistryDocuments({ agents, tools }) in src/registry-documents.mjs checks an
agents document and a tools document together. The caller has already read and parsed
both. The function reads no file and opens no directory.
agents: { agents: [{ id, allowedTools?: [toolId, ...] }] } or null
tools: { tools: [{ id }] } or null
It returns frozen { ok, missing, errors }.
- A document not supplied is named, not located. Each
nulldocument is named inmissingasagentsortools, in that order.missingcarries no path, file name, or extension. A missing tools document lists no tools, so every tool an agent names is then unknown. - A value that is not a document throws. A document that is neither a plain object
nor
nullthrowsRegistryDocumentError. That includes an absent key, a string, a number, a boolean, a list, and a function. The message does not repeat the value. - An agent that names an unknown tool is an error. Each name in an agent’s
allowedToolsmust be theidof an entry in the tools document. Otherwise the error isagents.<id>: references unknown tool "<name>". - Malformed entries are errors. The
agentsortoolskey holding something other than a list, an entry without a non-empty stringid, anidlisted twice, and anallowedToolsthat is not a list of non-empty strings are each one error. Errors are prefixedagents.<id>,tools.<id>, or<document>.#<index>when the entry has no id. A document that leaves its list out holds an empty list. okfails closed.okis true only whenmissinganderrorsare both empty.- It grants nothing. Listing a tool gives it to no agent, and naming it on an
agent’s
allowedToolsdoes not admit a call. Admission stays withadmitCaller, which this check does not change. The documents are not modified. - Only ids and
allowedToolsare read. Fields that name nodes, services, policies, or capabilities are left unread and are not checked. Tool ids are compared as strings. Their grammar ischeckRegistry’s job.
This ports the predecessor’s tool reference check only. Its directory resolution, file reads, document parsing, file paths in its missing list, and its checks of nodes, services, policies, capabilities, workflows, and command alignment are not ported.
Reading classes
read-effect tools run inside the attempt’s admitted scopes by default.- Every non-read class is admitted per objective (
allowedTools) and intended-before- effect (see run-model.md).credentialand third-party egress additionally setownerGate.
Verification
src/tool-id.mjs exports parseToolId, formatToolId, isValidToolId,
isWellFormedRegistryEntry, checkRegistry, rollbackPosture, and ROLLBACK_POSTURES;
the tests exercise grammar edges, forbidden-token classes, registry-entry shape, rollback
declarations, and cross-entry references. The grammar itself did not change in 0.2.0;
rollback is an additive, optional registry field. Renames are additive: legacyNames point back, and the
neutral ID stays the one true name.
src/registry-documents.mjs exports checkRegistryDocuments and
RegistryDocumentError. 0.8.0 adds them. No existing export changes, and every record
and registry valid under 0.7.0 stays valid.
Changes
0.9.0addscheckSchema,validateValue, and optional registryoutputSchema(CAP-03, seed#3).test/schema.test.mjschecks the subset and registry compatibility.