Write File
write_fileWrite text content to a file, automatically creating parent directories. Requires user confirmation to overwrite existing files.
Instructions
Create a new file or overwrite an existing one. Parent directories are created automatically.
Overwriting an EXISTING file requires interactive user approval (elicitation) — the server will pause and ask the connected client to confirm before proceeding.
Args:
path (string): Path to write to.
content (string): Text content to write (UTF-8).
overwrite (boolean, optional): Must be true to overwrite an existing file. Default: false.
Error Handling:
Returns an error without writing if the file exists and overwrite is not true.
Returns an error if the user declines the overwrite approval prompt.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to write to | |
| content | Yes | Text content to write | |
| overwrite | No | Set true to allow overwriting an existing file |