Skip to main content
Glama

git diff

git_diff
Read-onlyIdempotent

Diff 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

NameRequiredDescriptionDefault
baseNoBase revision, e.g. HEAD, main, a tag or a sha (default HEAD)
modeNostat = summary, patch = full unified diffstat
pathNoFile or directory to diff
repoYesAbsolute path to a git working tree, inside MCP_ALLOWED_ROOTS
context_linesNoContext lines per hunk in patch mode

Output Schema

NameRequiredDescriptionDefault
baseYesRevision the working tree was diffed against
diffYesRendered diff, capped like the text; truncated=true when it was cut
modeYes
pathYesPath the diff was scoped to, null for the whole tree
truncatedYesTrue when the diff was cut to fit the output budget

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.0

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false, so 'Read-only' in the description is redundant. The description earns credit by disclosing behavior the annotations do not: the exact return shape per mode and, importantly, that output can be truncated with a trailing note and how to narrow the request.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four short sentences, zero filler. Purpose and default are front-loaded, mode semantics follow, and the truncation remedy is last where an agent encountering the note will look for it.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be explained, yet the description usefully sketches them anyway. Combined with 100% parameter coverage and full annotation coverage, an agent has everything needed to call this correctly on the first attempt.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds value beyond the schema by spelling out that mode='stat' yields file names with line counts and mode='patch' yields the unified diff, and by naming path= and context_lines= as the levers for controlling output size.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a precise verb and resource: 'Diff the working tree against a base revision (default HEAD)'. The scope (working-tree diff, not history or status) makes it distinguishable from git_log and git_status, and it enumerates the two output modes an agent must choose between.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives clear operational context: the default base is HEAD, mode='stat' is the default, and it prescribes a recovery path ('narrow with path= or reduce context_lines=') when output is truncated. It stops short of explicitly routing to siblings like git_log for history or git_status for a change summary, so no exclusions are stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.