Edit a file
edit_fileReplace an exact string in an Overleaf project file and save changes via Git or web mode. Requires a unique match unless replace_all is set.
Instructions
Replace an exact string in a project file and save it to Overleaf. old_string must match exactly once unless replace_all is set. Uses Git; falls back to the opt-in web mode if enabled.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path relative to the project root. | |
| project | No | Project ID or Overleaf project URL (or project name in web mode). Defaults to OVERLEAF_PROJECT_ID. | |
| new_string | Yes | Replacement text. | |
| old_string | Yes | Exact text to replace, including whitespace. | |
| replace_all | No | Replace every occurrence instead of requiring a unique match. | |
| commit_message | No |