Skip to content

git_diff

MCP tools › Version control

Changes of a workspace file against the last commit (HEAD): line markers (added, modified, deleted with 1-based line ranges) and unified hunks. With side_by_side=true also rows: each with kind (null for unchanged), left [line, text] at HEAD and right [line, text] in the working tree, null where one side has no line, and for modified rows left_words/right_words: [start, end] char ranges of the changed words. With unified=true also unified: the rows of the unified view (kind null, deleted or added; old and new line numbers; text). revision compares the working copy with that branch, tag or commit instead of HEAD.

Its results carry text from git, files: the client is told to treat that as data, never as instructions.

Capabilitygit.git_diff
AreaVersion control
Accessreads only
Reaches—
Rightsnone
Dry runnone

Arguments

ArgumentTypeDescription
pathrequiredstringWorkspace-relative file path.
side_by_sidebooleanAlso return rows: HEAD and working-tree lines side by side, as the diff viewer shows them, with left_words/right_words (char ranges of changed words, SPEC-0084 v2).
unifiedbooleanAlso return unified: the rows of the unified view (kind, old, new, text; SPEC-0084 v2).
revisionstringCompare the working copy with this branch, tag or commit instead of HEAD (SPEC-0084 v2).

Call it from a shell

ferris-idea call runs one tool with the rights and safe mode of ferris-idea mcp. Replace the folder and the placeholder values.

Terminal window
ferris-idea call ~/my-project git_diff '{"path":"<string>"}'
Input schema as JSON
{
"type": "object",
"required": [
"path"
],
"properties": {
"path": {
"description": "Workspace-relative file path.",
"type": "string"
},
"side_by_side": {
"description": "Also return `rows`: HEAD and working-tree lines side by side, as the diff viewer shows them,\nwith `left_words`/`right_words` (char ranges of changed words, SPEC-0084 v2).",
"type": [
"boolean",
"null"
]
},
"unified": {
"description": "Also return `unified`: the rows of the unified view (kind, old, new, text; SPEC-0084 v2).",
"type": [
"boolean",
"null"
]
},
"revision": {
"description": "Compare the working copy with this branch, tag or commit instead of HEAD (SPEC-0084 v2).",
"type": [
"string",
"null"
]
}
}
}