Skip to main content
Glama

git_diff

Read-only

Compare staged, unstaged, or revision changes with native patches and typed file metadata to inspect differences before committing or reviewing.

Instructions

Compare index/worktree or revisions with native patches and typed file metadata.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "git_diff"
  }
}

Input Schema

NameRequiredDescriptionDefault
baseNo
modeNounstaged
pathsNo
targetNo
contextNo

Output Schema

NameRequiredDescriptionDefault
baseNo
modeYes
filesYes
patchYes
targetNo
process_idsNo
had_decoding_errorsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.5.1

TDQS

B3.1/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and a closed-world scope, so the safety profile is covered. The description adds that output comes as native patches plus typed file metadata, which is useful behavioral context beyond the annotations, but says nothing about size limits, how large diffs are handled, or truncation.

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

Conciseness4/5

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

A single front-loaded sentence with no filler, and the key notion (what is being compared) comes first. It is dense but not padded; a slightly more explicit clause on base/target would have cost little.

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

Completeness2/5

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

Five parameters, zero schema descriptions, and an ambiguous base/target pair make this under-specified despite the presence of an output schema and helpful annotations. An agent could not reliably construct a revision-mode call from this description alone.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must carry parameter meaning and largely does not. It hints at the index/worktree vs. revision distinction behind 'mode', but leaves 'base' vs. 'target' entirely unexplained — the most confusing pair in the schema — along with 'paths' filtering and 'context' line counts.

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 ('Compare') and specific resources ('index/worktree or revisions'), so the agent knows this produces a diff. It does not, however, distinguish itself from nearby siblings such as git_show or git_status, which an agent could reasonably confuse for reviewing changes.

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 phrase 'index/worktree or revisions' implies the two usage contexts (working-tree changes vs. commit-to-commit), which loosely maps to the mode enum. It never states when to prefer this over git_show or git_status, and gives no prerequisites or exclusions.

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