sassy_write_file
Write or append to files with custom encoding and line-ending options. Includes snapshot undo for rewrites and blocks sensitive paths.
Instructions
Write or append to a file. mode: rewrite | append.
encoding: any Python codec name (utf-8, utf-16, ascii, latin-1, ...). line_endings: 'preserve' (default — write content verbatim), 'lf' (normalize all CRLF/CR to LF before writing), 'crlf' (normalize all to CRLF — useful for Windows .bat / .ps1 files generated from a model that emits LF).
Rewrite mode on an existing file first snapshots the prior contents into the adjacent DELETE/ staging folder so destructive overwrites can always be undone. Protected paths (SassyMCP source tree, ~/.sassymcp) are refused.
Bypasses the shell-keyword interceptor entirely — content with
words like 'format' or 'rm -rf' as data inside scripts is fine.
Path validation runs _check_write_path (allowedDirectories +
sensitive-read denylist + protected roots) so an LLM cannot
write into ~/.ssh, ~/.aws, the SassyMCP source tree, etc. even
when allowedDirectories is empty.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | rewrite | |
| path | Yes | ||
| content | Yes | ||
| encoding | No | utf-8 | |
| line_endings | No | preserve |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |