Write file
write_fileCreate a file or replace its entire contents with text or bytes, using atomic writes on local disk. Use it to save content to one file; check existence first if the file must be new.
Instructions
Create a file or replace its whole contents with text or bytes. Use when: saving content to one file; to edit, read_file, change, write back. It always replaces: when the file must not exist yet, check with get_path_info first. Instead: copy_file to duplicate a file; create_directory for folders. Behavior: destructive - replaces the file. Atomic on the local disk (temp file, rename): a replaced file keeps its mode, a new one gets 0600. The parent must exist; a symlink at path is followed, a folder fails. The 16 MiB limit is the whole request, so content_b64 carries about 12 MiB. Time limit: 30 s. Returns: {size: bytes written}.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "write_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | The file to create or replace (absolute, or relative to the MCP root). Required unless path_b64 is given. | |
| backend | No | Backend id from list_backends; omit for the default. | |
| content | No | The new content as text, stored UTF-8 encoded. Required unless content_b64 is given; not both. | |
| path_b64 | No | path as base64 of its raw bytes, for non-UTF-8 names; replaces path. | |
| content_b64 | No | content as base64 of the raw bytes, for binary files; give this or content. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | Yes |