Skip to main content
Glama
GeminiDesk MCP
by LZ7TOP

Git Diff Viewer

git_diff

View code changes in the Git working tree or staging area, optionally for a specific file, to inspect modifications before committing.

Instructions

查看 Git 工作区或暂存区的代码变更内容。

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
fileNo可选仅查看指定文件的 diff
stagedNo是否查看已暂存变更 (--cached)
repoPathNoGit 仓库路径

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

B3.2/5.0
Behavior3/5

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

No annotations are provided, so the description must carry the burden of describing behavior. The verb '查看' (view) implies this is a read-only inspection, and the scope covers unstaged and staged changes, which is useful behavioral context. However, the description does not state that the operation is non-mutating, mention performance concerns or output size for large diffs, or describe the output format.

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?

The description is a single well-formed sentence with no wasted words, and it leads with the core action and scope. It is arguably too terse for a tool with no annotations, but nothing in the text is redundant or poorly ordered.

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

Completeness3/5

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

For a three-parameter read tool with full schema coverage and no output schema, the description covers the essential purpose, so an agent can call it correctly. It falls short of complete, however, because it omits expected output shape, behavior on large diffs, and guidance relative to sibling Git tools.

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?

All three parameters already have 100% description coverage in the schema, including the file filter, the staged (--cached) flag, and the repoPath field. The description only restates the working-tree and staging-area distinction that the staged parameter already captures, adding no details about file filtering, path format, or default behavior beyond what the schema states. The baseline score of 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 gives a specific verb and resource: view code changes in the Git working tree or staging area. This makes clear what the tool returns and scopes it to diff content, distinguishing it from siblings like git_log or git_status. It does not, however, explicitly set itself apart from the neighboring tools.

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 does not say when to use this tool instead of git_status or git_log, nor does it state prerequisites or exclusions. It implies the tool's purpose through the phrase '工作区或暂存区' (working tree or staging area), but it leaves the choice between the diff tool and status or log tools entirely to inference.

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