Write file
write_fileCreates a new file or overwrites an existing file with exact content, automatically creating parent directories. Use for full file writes when targeted edits are not needed.
Instructions
Create a file (parent directories are created automatically) or overwrite an existing file with exactly the given content. Use this for new files or full rewrites. Prefer edit_file or patch for targeted changes to existing files, because this tool replaces the whole file and is not reversible. The file is written to disk immediately.
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 | Workspace-relative path of the file to write. Absolute paths inside the workspace are also accepted. | |
| content | Yes | Exact file content to write, as a UTF-8 string. | |
| workspace | No | Workspace name (see workspace_list). Defaults to the primary workspace. |