write_file
Write or append to file contents.
Instructions
Write or append to file contents.
PDF creation is handled by the dedicated write_pdf tool.
Existing DOCX content can be edited with edit_block. New DOCX files can be created here; markdown headings (#, ##, ###) are converted to styled DOCX paragraphs.
CHUNKED WRITES:
- Repeated calls with mode='rewrite' followed by mode='append' are supported for longer files.
- Chunks of roughly 25-30 lines minimize latency when writing long text, multiple files, documentation, code, or configuration files.
- Files over 50 lines are still written successfully but may generate performance notes.
- For continuation after a partial write, the existing file state can be inspected before appending the remaining content.
FORMAT HANDLING (by extension):
- Text files: String content
- Excel (.xlsx, .xls, .xlsm): JSON 2D array or {"SheetName": [[...]]}
Example: '[["Name","Age"],["Alice",30]]'
Only works within allowed directories.
Absolute paths are the most reliable because they do not depend on the current working directory. Paths are automatically normalized regardless of slash direction. Relative paths depend on the current working directory, and tilde paths (~/...) may not resolve in every context. Absolute paths are generally the most reliable.
This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | rewrite | |
| path | Yes | ||
| origin | No | ||
| content | Yes |