Skip to main content
Glama

git_diff

Read-onlyIdempotent

Generate the git diff of a repository as file-level stats or a paginated patch. Limit by ref, path, and patch lines to inspect changes without loading large diffs.

Instructions

Return the git diff for a repository (stat + optional patch). Prefer stat_only=True for orientation.

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
refNoDiff target ref or range. Examples: "HEAD~1" (last commit), "main...HEAD" (branch diff), "abc123"HEAD~1
pathNoRepo-relative file path to limit the diff scope (optional). Leave empty for the full diff.
repoYesRepository name from list_repositories(), e.g. "pypto"
stat_onlyNoWhen True return only file-level statistics (no patch text). Useful for large diffs.
patch_offsetNoZero-indexed patch line offset for pagination
max_patch_linesNoMaximum patch lines to return (100–2000)

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.6.0
    • addedInput schema / properties / max_patch_lines
      Added value: +{
      +  "default": 500,
      +  "description": "Maximum patch lines to return (100–2000)",
      +  "maximum": 2000,
      +  "minimum": 100,
      +  "title": "Max Patch Lines",
      +  "type": "integer"
      +}
    • addedInput schema / properties / patch_offset
      Added value: +{
      +  "default": 0,
      +  "description": "Zero-indexed patch line offset for pagination",
      +  "minimum": 0,
      +  "title": "Patch Offset",
      +  "type": "integer"
      +}
  2. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and closed-world scope, so the safety profile is covered. The description adds the useful fact that patch text can be omitted for orientation, but says nothing about ref resolution failures, missing repos, or how pagination interacts with stat_only.

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?

Two short sentences, front-loaded with the resource and return shape, then immediately the actionable preference. Every clause earns its place with no restating of the tool name or filler.

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

Completeness4/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-value documentation is unnecessary, and pagination details live in the schema. For a simple read-only diff tool the description is nearly sufficient; only failure modes for an invalid ref or unknown repo are unaddressed.

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

Parameters3/5

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

Schema description coverage is 100%, so ref, path, stat_only, patch_offset and max_patch_lines are already documented in the input schema; baseline is 3. The description supplements semantics for stat_only slightly (orientation use) but adds nothing for the pagination parameters or the range syntax.

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

Purpose4/5

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

The description uses a specific verb and resource ("Return the git diff for a repository") and states the output shape (stat + optional patch), so an agent immediately knows what it retrieves. It does not explicitly distinguish itself from the sibling git_log, which is the main missing differentiator.

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

Usage Guidelines3/5

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

The only guidance is "Prefer stat_only=True for orientation," which advises on a parameter rather than on when to choose git_diff over git_log or another inspection tool. Usage context is implied (diff inspection) but no when-not or alternative-tool routing is given.

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