Skip to main content
Glama

Git Diff

git_diff
Read-only

Compare Git commits, branches, or working tree states to view code differences in unified diff format. Review staged or unstaged changes, analyze file statistics, and filter by specific paths to track modifications.

Instructions

View differences between commits, branches, or working tree. Shows changes in unified diff format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoPath to the Git repository. Defaults to session working directory set via git_set_working_dir..
targetNoTarget commit/branch to compare against. If not specified, shows unstaged changes in working tree.
sourceNoSource commit/branch to compare from. If target is specified but not source, compares target against working tree.
pathsNoLimit diff to specific file paths (relative to repository root).
stagedNoShow diff of staged changes instead of unstaged.
includeUntrackedNoInclude untracked files in the diff. Useful for reviewing all upcoming changes.
nameOnlyNoShow only names of changed files, not the diff content.
statNoShow diffstat (summary of changes) instead of full diff content.
contextLinesNoNumber of context lines to show around changes.
autoExcludeNoAutomatically exclude lock files and other generated files (e.g., package-lock.json, yarn.lock, bun.lock, poetry.lock, go.sum) from diff output to reduce context bloat. Set to false if you need to inspect these files.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successYesIndicates if the operation was successful.
diffYesThe diff output in unified diff format.
filesChangedYesNumber of files with differences.
insertionsNoTotal number of line insertions.
deletionsNoTotal number of line deletions.
excludedFilesNoFiles that were automatically excluded from the diff (e.g., lock files). Call again with autoExclude=false to include them.
Behavior3/5

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

Annotations declare readOnlyHint=true, confirming safety. The description adds value by specifying the output format ('unified diff format'), which is behavioral context not in the schema. However, it misses other behavioral traits like how it handles binary files, large diffs, or the default exclusion of lock files (mentioned only in parameter schema).

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 sentences with zero waste. The first establishes scope, the second output format. Every word earns its place—no redundant filler or obvious restatements of the tool name.

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?

Given the presence of an output schema and 100% parameter coverage, the description does not need to exhaustively detail returns or parameters. It successfully covers the tool's purpose and output format. A score of 4 reflects adequate coverage; a 5 would require addressing edge cases like binary file handling or performance notes.

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?

With 100% schema description coverage, the schema carries the full burden of parameter documentation. The description implies the conceptual model (source/target comparisons) but does not add syntax details, examples, or clarify relationships between parameters (e.g., how source/target interact) beyond what the schema provides. Baseline 3 is appropriate.

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 clearly states the core function ('View differences') and the specific scopes (commits, branches, working tree). It distinguishes from siblings like git_status (which shows summary status) by specifying it shows actual differences, though it could explicitly mention it performs comparisons versus showing historical logs.

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

Usage Guidelines2/5

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

The description provides no explicit guidance on when to use this tool versus alternatives like git_status (for summary changes) or git_show (for specific commit details). It does not mention prerequisites such as being inside a git repository or having a working tree available.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cyanheads/git-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server