# apply_patch Tool Documentation ## Overview The `apply_patch` tool enables file changes using a structured patch format with support for multi-file or multi-hunk edits where a single `edit` call would be brittle. ## Core Functionality This tool processes a single input string containing one or more file operations, structured with `*** Begin Patch` and `*** End Patch` markers. ## Supported Operations - **Add File**: Introduces new files with `*** Add File: path/to/file.txt` - **Update File**: Modifies existing files with `*** Update File: src/app.ts` - **Delete File**: Removes files with `*** Delete File: obsolete.txt` - **Rename Files**: Uses `*** Move to:` within update hunks ## Key Parameters The tool requires a single `input` parameter containing the complete patch contents with appropriate delimiters. ## Important Constraints - Paths resolve relative to workspace root - Currently experimental and disabled by default - Requires activation via `tools.exec.applyPatch.enabled` - OpenAI-exclusive support (including Codex) - Configuration available under `tools.exec` namespace only ## Special Markers `*** End of File` designates EOF-only insertions when necessary.