write_file
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.
Paths refer to the selected device. Relative paths depend on that device's 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 | ||
| content | Yes | ||
| deviceId | No | The ID of the device to run this tool on (from list_devices). Required when more than one device is online; may be omitted when only one device is connected. |