# willo_edit_file

> Change part of a site file on GitHub by exact text replacement — the default way to change an existing file.

Generated from Willo's code at each release.

Source: https://www.willo.ai/docs/reference/mcp-tools/willo_edit_file

**Edit a site file.** `old_text` + `new_text` for one replacement, or `edits: [{old_text, new_text}, …]` (up to 25, all-or-nothing, each old_text unique in the file) for several in one commit. Copy old_text exactly from willo_read_file. Lands on `draft` while drafting, else on `main` and LIVE at once. Pass `sha` to insist on the version you read. Runs without a card, except package.json and lockfiles (a person approves the dependency change). Same refusals as willo_write_file. Undoable from the dashboard.

## Access

- **Token**: read + act, and editor access or higher on the business.
- **Approval**: Only when Willo's chat would stop for the same action. The description says when; otherwise the call runs at once.
- **Secret scan**: refused if the new content holds a value shaped like an API key or token.
- **Metered**: counts toward a per-business, per-minute limit for this kind of call. See [Limits](https://www.willo.ai/docs/reference/limits).

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `path` | string | yes | Repo-relative path of an existing file. |
| `old_text` | string | no | Single form: the exact text to replace. Omit when using edits. |
| `new_text` | string | no | Single form: the replacement. Omit when using edits. |
| `edits` | object[] | no | Batch form: several replacements in this one file, applied together or not at all. |
| `sha` | string | no | Optional: the `sha` from willo_read_file; the edit is refused if the file has changed since. |
| `summary` | string | no | One plain sentence for the owner on what this does for them. |

## Related

- [All MCP tools](https://www.willo.ai/docs/reference/mcp-tools)
- [Error codes](https://www.willo.ai/docs/reference/errors)
- [Draft and live](https://www.willo.ai/docs/ai-agents/draft-and-live)
