API Reference
readTool
function readTool(backend): Tool;Defined in: tools/builtin/file-read.ts:40
Build a read tool bound to a backend.
Parameters
| Parameter | Type | Description |
|---|---|---|
backend | FileReadBackend | The FileReadBackend that performs the actual read. |
Returns
A Tool named read ready to pass to the agent loop or a ToolRegistry.
Remarks
Read-only, so it keeps the default parallel execution mode. The result is
shaped by formatFileContent, which prefixes each line with its 1-based
number — the same path:line:-style addressing search uses, so the model
can quote line numbers back into an edit.
See
Example
const tool = readTool(myFileReadBackend);
await runAgent({ ...opts, tools: [tool] });
// The model can now call: read({ path: "src/app.ts", offset: 40, limit: 20 })