apply_patch
Apply JSON patch operations to a file after verifying its SHA-256 hash, enabling exact replacement and insertion edits.
Instructions
Apply JSON patch operations to a file within a Direct session's repo_path. Validates expected_sha256 before applying. Supports replace_exact, insert_before, insert_after, replace_whole_file.
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": {
"session_id": "<session_id>",
"path": "<path>",
"expected_sha256": "<expected_sha256>",
"operations": "<operations>"
},
"name": "apply_patch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Relative file path within the session repo | |
| review_id | No | Fresh review ID for this exact operation when required. | |
| operations | Yes | ||
| session_id | Yes | Session ID | |
| expected_sha256 | Yes | Expected SHA-256 hash of the current file content |