git diff
git_diffDiff the working tree against a base revision to see changed files with line counts or a full unified patch. Use it to review uncommitted edits before committing.
Instructions
Diff the working tree against a base revision (default HEAD). Read-only. mode='stat' (default) returns file names with line counts; mode='patch' returns the unified diff. If the output ends with a truncation note, narrow with path= or reduce context_lines=.
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": {
"repo": "<repo>"
},
"name": "git_diff"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base | No | Base revision, e.g. HEAD, main, a tag or a sha (default HEAD) | |
| mode | No | stat = summary, patch = full unified diff | stat |
| path | No | File or directory to diff | |
| repo | Yes | Absolute path to a git working tree, inside MCP_ALLOWED_ROOTS | |
| context_lines | No | Context lines per hunk in patch mode |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base | Yes | Revision the working tree was diffed against | |
| diff | Yes | Rendered diff, capped like the text; truncated=true when it was cut | |
| mode | Yes | ||
| path | Yes | Path the diff was scoped to, null for the whole tree | |
| truncated | Yes | True when the diff was cut to fit the output budget |