# willo_edit_function

> Change part of a deployed backend Edge Function by exact text replacement (old_text → new_text, or edits for several) and redeploy it…

Generated from Willo's code at each release.

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

**Edit an Edge Function.** Change part of a deployed backend Edge Function by exact text replacement (`old_text` → `new_text`, or `edits` for several) and redeploy it — on the draft backend while drafting, else LIVE; the source is saved to the repo too. `source_sha256` is REQUIRED: the value willo_get_function returned, so you only edit the version you read (a stale one is refused). Runs without a card like in chat (one-click undo from the dashboard), except a function with admin powers and no caller check, which is refused until `public_admin_reason` and then needs a person's approval. `summary` is required.

## 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 |
| --- | --- | --- | --- |
| `name` | string | yes | The function's slug. |
| `source_sha256` | string | yes | source_sha256 from willo_get_function for the version you read. |
| `old_text` | string | no | Single form: exact text to replace. |
| `new_text` | string | no | Single form: the replacement. |
| `edits` | object[] | no | Batch form: several replacements, one redeploy. |
| `verify_jwt` | boolean | no | Override the deployed setting (default: keep it). |
| `import_map` | string | no | Override the import map (JSON string). |
| `summary` | string | yes | One plain sentence for the owner: what the change does for them. |
| `public_admin_reason` | string | no | Only after a refusal naming it. |

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