API Reference
editTool
function editTool(backend): Tool;Defined in: tools/builtin/file-write.ts:78
Build an edit tool bound to a backend.
Parameters
| Parameter | Type | Description |
|---|---|---|
backend | FileWriteBackend | The FileWriteBackend that actually edits the host. |
Returns
A Tool named edit ready to pass to the agent loop or a ToolRegistry.
Remarks
Runs sequentially (ExecutionMode.Sequential): like write, edits
mutate the host and ordering matters. Results are shaped by
formatEditResult, which surfaces a missing target string in the content
(model-recoverable) rather than as a thrown error.
See
Example
const tool = editTool(myFileWriteBackend);
await runAgent({ ...opts, tools: [tool] });
// The model can now call: edit({ path: "app.ts", oldString: "v1", newString: "v2" })