edit_file
Replace exact text in an existing file to apply small, well-defined edits. If the match is stale or ambiguous, nothing is written—re-read the file and retry.
Instructions
Edit an existing file directly via exact-match replacement (free — no Codex usage). The search text must match the file's current content exactly, once (or set replace_all) — a stale or ambiguous match refuses with nothing written, so re-read the file and retry. Use for small, well-defined edits ChatGPT can make itself; delegate large multi-file work to implement.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the file, relative to the project or absolute inside it. | |
| search | Yes | Exact text to find (must match the current file content). | |
| project | No | Project path the user named in chat (armed via init). Pass it explicitly on every call. If no project has been named, ask the user; never guess. | |
| replace | Yes | Replacement text. | |
| replace_all | No | Replace all occurrences (default false: exactly one must match). | |
| session_token | No | Session token returned by init (or create_project). Required for every project tool call in this chat. A new chat must be re-armed. |