Skip to main content
Glama

Git diff

git_diff
Read-only

Compares Git refs or staged changes and returns changed files with insertion/deletion counts. Scope results by file path or compare two refs for structured diff output.

Instructions

Structured git diff: files changed with insertions/deletions counts. Use base+ref for two-ref comparison (e.g. base='main', ref='feature'). Use path to scope to one or more files or directories.

Input Schema

NameRequiredDescriptionDefault
cwdNoRepository path
refNoRef to diff against (e.g. 'main', 'HEAD~3')
baseNoBase ref for two-ref comparison. When both ref and base are set, runs git diff <base> <ref>
pathNoLimit diff to one or more files or directories (string or array)
stagedNoShow staged changes

Output Schema

NameRequiredDescriptionDefault
filesYes
retainedNo
fileCountYes
totalDeletionsYes
totalInsertionsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv5.0.1

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, so safety is covered; the description adds that output is per-file change counts rather than patch bodies. It says nothing about defaults when no ref/base are given, untracked or binary files, rename detection, or how staged combines with other params.

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?

Three short sentences, purpose first, then the two non-obvious parameters. No filler and nothing repeated needlessly.

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?

Output schema exists, so return values need no explanation, and all five parameters are documented. The remaining gap is behavioral: what the tool does by default with no ref (working tree vs index) and whether staged combines with base/ref, which an agent would need to reason out.

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% and the schema already explains base/ref combination ('git diff <base> <ref>') and path scoping. The description only restates those with a slightly friendlier example, so the baseline of 3 applies.

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?

States a specific verb and resource plus the shape of the result: 'Structured git diff: files changed with insertions/deletions counts.' That implicitly separates it from git_diff_content (patch text), but the sibling is never named, so an agent must infer the split.

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 concrete invocation guidance: base+ref for two-ref comparison with a worked example (base='main', ref='feature'), and path for scoping to files or directories. It stops short of saying when to prefer git_diff_content or how staged interacts with base/ref.

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