Open Agent Loops
API Reference

readTool

@open-agent-loops/core


function readTool(backend): Tool;

Defined in: tools/builtin/file-read.ts:40

Build a read tool bound to a backend.

Parameters

ParameterTypeDescription
backendFileReadBackendThe FileReadBackend that performs the actual read.

Returns

Tool

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 })

On this page