Browse notes
Tool Use
A tool exposes an operation the model can request. Its definition normally includes a name, description, and parameter schema; the model generates the call, while the harness or application decides whether it can run and performs the operation.
A minimal file-reading tool could look like this:
{
"name": "read_file",
"description": "Read a range of lines from a text file",
"parameters": {
"type": "object",
"properties": {
"path": { "type": "string" },
"start_line": { "type": "integer" }
},
"required": ["path"]
}
}
The description helps the model choose the tool, while the schema constrains the shape of its arguments. If an operation deletes data, sends a message, or requires a precondition, that should be clear before execution.
Tool call and execution
If the model needs to inspect src/app.ts, it can emit a read_file call with that path. The application validates the arguments, applies any relevant permission checks, reads the file, and returns the requested lines. The model then uses that result to decide whether it needs another read, a change, or a final answer.
The schema constrains argument structure, not the full validity of the operation. A path can be a valid string while still pointing outside scope, and a well-formed call may still require approval.
Results
A result should contain what the next decision needs while preserving detail that could change that decision. Depending on the tool, this may be shell output, stable JSON fields, or a reference to a larger artifact.
Size matters because tool output may enter the next inference. For file reads, ranges are usually easier to work with than returning the whole file every time. For a large log, the runtime can retain the source and send only matching lines or the relevant region.
Errors are part of the same contract. If a file does not exist, returning that failure lets the model correct the path. Success-shaped output that hides the error only makes the next decision worse.
Side effects and retries
read_file is normally safe to repeat without changing the environment. send_message can duplicate a send after a timeout, while a repeated delete_file may encounter state changed by the first attempt.
For operations with side effects, the system should determine whether the first execution completed before retrying. Permissions, approval, operation IDs, or idempotency mechanisms can be part of that check depending on the tool and external service.