Write File
write_fileCreate or overwrite files with automatic parent directory creation and syntax validation for Python, JSON, TOML, and YAML. Optionally fail on existing files to prevent accidental overwrites.
Instructions
Create or overwrite a file. Creates parent dirs. For partial edits use search_and_replace. Validates .py/.json/.toml/.yaml syntax before writing.
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": {
"filepath": "<filepath>",
"content": "<content>"
},
"name": "write_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Complete file content. | |
| filepath | Yes | File path relative to /workspace. | |
| create_only | No | If true, fail when file exists. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |