apply_patch
Apply agent-generated unified diffs to files. Use check_only to verify the patch applies cleanly before writing changes.
Instructions
Apply an agent-generated unified diff to files under target_path.
Uses git apply, which refuses paths that escape the target directory.
Run with check_only=True first to verify the patch applies cleanly
before writing changes.
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": {
"target_path": "<target_path>",
"patch": "<patch>"
},
"name": "apply_patch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target_path | Yes | Directory the patch paths are relative to. | |
| patch | Yes | The unified diff text to apply. | |
| check_only | No | If True, validate without modifying any files. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |