Git diff
git_diffParses staged or worktree Git diffs into per-file hunks for code review, previews, or tests, with optional unified patch text via include_patch.
Instructions
Parsed git diff (staged or worktree): files + hunks (old_start/lines, new_start/lines, section). Patch text is opt-in via include_patch=true. Use when: you need per-file hunk info for review/preview or a test, not free text. Avoid when: you need a raw unified blob (use include_patch=true or diff_files) or a PR diff (provider tools). Output: files[] {old_path|null, new_path|null, action (added|modified|deleted|renamed), binary, hunks[] {old_start, old_lines, new_start, new_lines, section}}, counts{}, patch_bytes, patch/patch_truncated when include_patch=true.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "git_diff"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paths | No | Optional workspace-relative paths to limit the diff. | |
| reason | No | Optional why (max 400 chars), audit-logged. | |
| staged | No | true compares the index to HEAD (git diff --cached); false compares worktree to HEAD/index. | |
| max_bytes | No | Patch text budget when include_patch=true (default 65536). | |
| context_lines | No | Unified-diff context lines (default 3). | |
| include_patch | No | true includes the unified diff text (truncated to max_bytes). |