file_replace_lines
Replace an inclusive 1-based line range with new content, preview changes with a dry run, and keep each edit undoable while preserving file formatting.
Instructions
Replace an inclusive 1-based line range and return operation_id and undo_available.
Use this for genuinely positional work; file_replace_text is cheaper when
the line numbers are not already known. Out-of-range references are
refused, never clamped. The file's newline convention and byte-order mark
are preserved, and a replacement without a trailing newline does not fuse
lines. dry_run returns a unified diff preview and writes nothing.
Otherwise the operation is recorded and undoable.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| dry_run | No | ||
| end_line | Yes | ||
| start_line | Yes | ||
| replacement | Yes | ||
| expected_hash | No | ||
| expected_content | No |