fs_write_binary
Write binary files to your project from Base64 data with atomic replacement and SHA-256 validation. Enforces size limits and supports safe creation or update of files.
Instructions
Write a binary file under the project root from plain Base64 (not a data URL; no remote fetch). Requires lease_id. Line breaks and the URL-safe alphabet are accepted; padding is optional. Decoded size capped at 2_000_000 bytes (coupled with Caddy 4MB body limit). For existing files, expected_sha256 is mandatory (use sha256 from fs_read UNSUPPORTED_BINARY); CONFLICT if the file changed. create=true allows new files (empty expected_sha256). Atomic temp+fsync+replace. Same write gates as fs_apply_patch.
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>",
"lease_id": "<lease_id>",
"content_base64": "<content_base64>"
},
"name": "fs_write_binary"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| create | No | ||
| project | No | demo | |
| lease_id | Yes | ||
| content_base64 | Yes | ||
| expected_sha256 | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||