append_to_file
Append text to the end of a file. Optionally add a trailing newline before the appended content. Writes atomically to avoid corruption.
Instructions
Append content to the end of a file (byte concatenation). Optional ensure_newline_before. Writes atomically.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute or workspace-relative path to the file. | |
| content | Yes | Text to append, written byte-for-byte. The caller is responsible for all line endings and spacing. | |
| encoding | No | File encoding. Default: utf-8. Pass utf-8-sig to strip a BOM. | utf-8 |
| project_root | No | Sets (and remembers) the project root for resolving relative paths for this and subsequent calls in the session. | |
| ensure_newline_before | No | If true, insert a single dominant-style line terminator between the original last line and content, but only if the file lacks a trailing one. |