Skip to main content
Glama
martinsky999

MCP Git Server

by martinsky999

git_diff_unstaged

View uncommitted changes in your working directory before staging them for commit, helping you review modifications.

Instructions

Shows changes in the working directory that are not yet staged

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes

Implementation Reference

  • Core handler function implementing the git_diff_unstaged tool logic by calling repo.git.diff() to get unstaged changes.
    def git_diff_unstaged(repo: git.Repo) -> str:
        return repo.git.diff()
  • Pydantic schema defining the input for git_diff_unstaged tool: requires repo_path.
    class GitDiffUnstaged(BaseModel):
        repo_path: str
  • Tool registration in list_tools(): defines name 'git_diff_unstaged' (via GitTools.DIFF_UNSTAGED), description, and input schema.
        name=GitTools.DIFF_UNSTAGED,
        description="Shows changes in the working directory that are not yet staged",
        inputSchema=GitDiffUnstaged.schema(),
    ),
    Tool(
  • Enum defining tool names, including DIFF_UNSTAGED = "git_diff_unstaged" used in registration.
    class GitTools(str, Enum):
        STATUS = "git_status"
        DIFF_UNSTAGED = "git_diff_unstaged"
        DIFF_STAGED = "git_diff_staged"
        DIFF = "git_diff"
        COMMIT = "git_commit"
        ADD = "git_add"
        RESET = "git_reset"
        LOG = "git_log"
        CREATE_BRANCH = "git_create_branch"
        CHECKOUT = "git_checkout"
        SHOW = "git_show"
        INIT = "git_init"
  • Dispatcher in @server.call_tool(): handles the git_diff_unstaged tool call, invokes the handler, and formats response.
    case GitTools.DIFF_UNSTAGED:
        diff = git_diff_unstaged(repo)
        return [TextContent(
            type="text",
            text=f"Unstaged changes:\n{diff}"
        )]

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.4/5.0
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It describes what the tool does but doesn't mention output format, whether it shows full diffs or summaries, potential side effects, or error conditions. 'Shows changes' is vague about behavioral characteristics.

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?

Single sentence, zero waste, front-loaded with the core purpose. Every word earns its place in conveying the essential function.

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 single-parameter tool with no annotations and no output schema, the description adequately states what it does but lacks details about output format, error handling, or behavioral nuances. It's complete enough for basic understanding but leaves operational questions unanswered.

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

Parameters4/5

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

The description doesn't mention parameters at all, but with only 1 parameter and 0% schema description coverage, the baseline would be lower. However, the tool name and description strongly imply the repo_path parameter context, providing meaningful semantic context beyond the bare schema.

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 verb 'shows' and the resource 'changes in the working directory' with the specific condition 'that are not yet staged'. It distinguishes from sibling git_diff_staged by specifying unstaged changes, but doesn't explicitly differentiate from git_diff which might show both staged and unstaged 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 description implies usage context (when you want to see unstaged changes) but doesn't provide explicit guidance on when to use this versus alternatives like git_diff or git_status. No exclusions or prerequisites are mentioned.

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