write_file
Create a new file or replace/append content to an existing file in the repository. Handles whole-file writes and creates parent directories; use edit_file for targeted edits.
Instructions
Create a new file, or replace / append to an existing one. Use this for NEW files. To change part of an existing file use edit_file instead — it is safer and much cheaper than resending the whole 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 |
|---|---|---|---|
| mode | No | create (default, fails if the file exists), overwrite, or append. | |
| path | Yes | File path relative to the workspace root. Parent directories are created. | |
| content | Yes | Full file content (or the text to append). | |
| workspace | No | Workspace alias. Defaults to the active workspace. |