Surgical find/replace in one file
update_file_contentApply one or more literal find/replace edits to a single file on the site, in one tool call. Designed for tiny edits where uploading the full file would be wasteful (one nav-button reference, one encoding fix, one env var bump). Each edit must specify how many matches it expects; mismatches abort the whole call with NO writes. For dist edits the change goes live immediately; for source edits you still need to call build_and_deploy.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Site name. | |
| path | Yes | File-relative path inside the chosen target tree. | |
| edits | Yes | Ordered list of edits to apply atomically. Each is `{find, replace, count?}`. If any edit's match count doesn't equal its expected count, the whole call aborts with no writes. | |
| target | No | Which tree to edit. 'dist' (default) edits the served file directly — visitors see the change immediately. 'source' edits the editable source tree; you'll need build_and_deploy (or it short-circuits via noBuild) to ship. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| path | Yes | ||
| edits | Yes | ||
| siteId | Yes | ||
| target | Yes | ||
| afterBytes | Yes | ||
| request_id | No | Server-assigned request correlation id. Quote it when contacting support. | |
| beforeBytes | Yes |