Skip to main content
Glama
martinsky999

MCP Git Server

by martinsky999

git_diff_staged

View staged changes before committing to review modifications in your Git repository.

Instructions

Shows changes that are staged for commit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes

Implementation Reference

  • Core handler function that executes the git diff for staged changes using the gitpython library.
    def git_diff_staged(repo: git.Repo) -> str:
        return repo.git.diff("--cached")
  • Pydantic BaseModel defining the input schema for the git_diff_staged tool, which requires a repo_path string.
    class GitDiffStaged(BaseModel):
        repo_path: str
  • Registration of the git_diff_staged tool in the list_tools() function, specifying name, description, and input schema.
    Tool(
        name=GitTools.DIFF_STAGED,
        description="Shows changes that are staged for commit",
        inputSchema=GitDiffStaged.schema(),
    ),
  • Enum constant defining the tool name 'git_diff_staged' within GitTools enum.
    DIFF_STAGED = "git_diff_staged"
  • Dispatcher case in call_tool() that invokes the git_diff_staged handler and formats the response.
    case GitTools.DIFF_STAGED:
        diff = git_diff_staged(repo)
        return [TextContent(
            type="text",
            text=f"Staged changes:\n{diff}"
        )]
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'shows' changes, implying a read-only operation, but doesn't specify output format, error handling, or any side effects. For a tool with zero annotation coverage, this is insufficient to inform the agent about behavioral traits beyond the basic action.

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?

The description is a single, clear sentence with no wasted words: 'Shows changes that are staged for commit.' It is front-loaded and efficiently conveys the core purpose without unnecessary elaboration, making it easy for an AI agent to parse quickly.

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?

Given the complexity of Git operations, no annotations, no output schema, and low schema coverage (0%), the description is incomplete. It doesn't explain what 'shows' entails (e.g., output format), how it interacts with sibling tools, or any behavioral nuances. For a tool in this context, more detail is needed to ensure the agent can use it effectively.

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?

The description adds no information about parameters beyond what the input schema provides. With 0% schema description coverage and 1 parameter ('repo_path'), the schema lacks details like format or examples. The description doesn't compensate by explaining the parameter's role or usage, but since there's only one parameter, the baseline is adjusted to 3 for minimal viability.

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 tool's purpose: 'Shows changes that are staged for commit.' It specifies the verb 'shows' and the resource 'changes that are staged for commit,' making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'git_diff' or 'git_diff_unstaged,' which prevents a score of 5.

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 guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'git_diff' (for all changes) or 'git_diff_unstaged' (for unstaged changes), nor does it specify prerequisites or contexts for usage. This lack of comparative or contextual advice limits its helpfulness for an AI agent.

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/martinsky999/mcp-git-py'

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