# `Alloy.Tool.Core.Edit`
[🔗](https://github.com/alloy-ex/alloy/blob/v0.10.1/lib/alloy/tool/core/edit.ex#L1)

Built-in tool: search-and-replace edits on files.

Finds `old_string` in the file and replaces it with `new_string`.
By default, the match must be unique (appears exactly once). Set
`replace_all: true` to replace all occurrences. Returns an error
if no match is found or if the match is ambiguous.

## Usage

    config = %{tools: [Alloy.Tool.Core.Edit], ...}

The agent can then call:

    %{file_path: "lib/app.ex", old_string: "v1", new_string: "v2"}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
