file_write
Replace an entire file atomically with new content, using expected hash and dry-run checks to prevent conflicts. Returns an operation ID and undo availability.
Instructions
Replace a whole file with new content and return operation_id and undo_available.
The replacement is atomic: a crash leaves the complete previous content.
expected_hash guards against clobbering a file that changed since it was
read; a mismatch is CONTENT_CONFLICT and nothing is written. The file's
encoding and byte-order mark are inherited unless encoding is named.
Credential-shaped targets are refused unless i_accept_secret_write_risk
is true. dry_run validates and writes nothing. Otherwise the operation is
recorded and undoable. Not idempotent: each successful call adds a
history record.
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": "file_write"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| content | Yes | ||
| dry_run | No | ||
| encoding | No | ||
| expected_hash | No | ||
| i_accept_secret_write_risk | No |