Write file
write_fileWrite a file into the sandbox (creates missing parent directories, overwrites an existing file); returns the path and the number of bytes written. Use it to put source code, configuration or data in place before running it; set base64=true for binary content. For a one-off script you only want to execute, running the code directly is shorter; files and directories are removed with the delete tool.
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 | Absolute path, e.g. /home/user/app/main.py | |
| base64 | No | Content is base64 (for binary files) | |
| content | Yes | File content (text, or base64 when base64=true) | |
| sandbox_id | No | Sandbox ID (sb_…). If omitted, the current sandbox of this session is used. A sandbox_id you pass becomes the current sandbox for later calls without sandbox_id. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path of the written file. | |
| bytes | Yes | Number of bytes written. | |
| sandbox_id | Yes | Sandbox ID. |