write_file
Creates a UTF-8 text file at a specified workspace path, replacing existing content only when overwrite is enabled. Ideal for new files; use update_file for modifying existing files.
Instructions
Create a UTF-8 text file, or replace one when "overwrite" is true. Prefer edit_file or update_file for changes to an existing file.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>",
"content": "<content>"
},
"name": "write_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path relative to the workspace root, or an allowed absolute path. | |
| content | Yes | Complete UTF-8 file content. | |
| overwrite | No | Allow replacing an existing file; defaults to false. | |
| expected_sha256 | No | Optional SHA-256 returned by a previous read or write. The call fails if the file changed since then. |