A tool description has three parts: a name, a purpose in plain words, and a parameter schema. The program owns this text, and the model only reads it.
Part | Example for | Why it matters |
|---|---|---|
Name |
| Routes the call to exactly one implementation. |
Purpose | Read one 8-bit control register by address. | Tells the model when this tool fits the task. |
Parameter schema |
| Lets the program accept or reject each argument. |
A schema names each argument, its type, and its allowed range. Required arguments are marked, and missing ones are rejected before anything runs.
Types here are ordinary JSON types: integer, string, boolean, and small objects. Bounds keep values inside the range the tool serves.
Argument | Type | Bounds | Required |
|---|---|---|---|
| integer | 0 to 15 | Yes |
| integer | 0 to 15 | Yes |
| integer | 0 to 255 | Yes |
| string | Must name a known block | Yes |
The trace below is schematic, not output from any real system. It shows one task turning into one validated call.
schematic trace (illustrative, not from any real system)
task: read control register 8
model proposes: {"tool": "read_register", "arguments": {"addr": 8}}
program checks: tool known, addr present, addr is integer, 0 <= 8 <= 15
verdict: ok -> run read_register, return the 8-bit value as observationThe program below stands in for the loop with a fake scripted model. It routes two tools and names three faults over six checks.
import json
TOOLS = {
"read_register": {"purpose": "Read one 8-bit control register by address.", "required": ["addr"]},
"run_lint": {"purpose": "Run the lint suite over one named block.", "required": ["block"]},
}
def fake_model(task):
if "register 8" in task:
return {"tool": "read_register", "arguments": {"addr": 8}}
return {"tool": "run_lint", "arguments": {"block": "alu"}}
def dispatch(call):
name = call.get("tool")
args = call.get("arguments")
if name not in TOOLS:
return "unknown-tool"
if not isinstance(args, dict):
return "bad-arguments"
for key in TOOLS[name]["required"]:
if key not in args:
return "missing-field"
return "ok:" + name
bad = 0
if dispatch(fake_model("read register 8")) != "ok:read_register":
bad += 1
if dispatch(fake_model("lint the alu")) != "ok:run_lint":
bad += 1
if dispatch({"tool": "nope", "arguments": {}}) != "unknown-tool":
bad += 1
if dispatch({"tool": "read_register", "arguments": {}}) != "missing-field":
bad += 1
if dispatch({"tool": "read_register", "arguments": [8]}) != "bad-arguments":
bad += 1
if dispatch(json.loads(json.dumps(fake_model("read register 8")))) != "ok:read_register":
bad += 1
if bad == 0:
print("PASS: 6 registry checks route 2 tools and name 3 faults")
else:
print("FAIL: " + str(bad) + " of 6 registry checks went wrong")
raise SystemExit(1)A name, a one-line purpose, and a schema marking addr an integer from 0 to 7 and required.
It rejects the call as an unknown tool. Only registered names ever execute.