ketan_write_file_safe
Write files with pre-flight validation, atomic snapshots, and automatic rollback on failure.
Instructions
Write a file to the workspace with FULL Ketan-OS protection:
Pre-flight invariant guard: Python AST syntax check for .py files, dangerous pattern detection.
Atomic snapshot of current workspace state before writing.
Write the file.
On any failure → automatic rollback to pre-write state.
Always prefer this over direct file writes for safe, reversible mutations.
Args: filepath: Path relative to workspace root (e.g., "src/main.py") content: Full file content to write
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": "ketan_write_file_safe"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | ||
| filepath | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |