Skip to main content
Glama

git_diff_staged

View staged changes in a Git repository to review modifications before committing. Simplifies tracking and verifying updates for better version control management.

Instructions

Shows changes that are staged for commit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes

Implementation Reference

  • The handler function that executes the core logic of the git_diff_staged tool, returning the diff of staged changes using gitpython's Repo.git.diff with --cached option.
    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, requiring a repo_path.
    class GitDiffStaged(BaseModel): repo_path: str
  • Registration of the 'git_diff_staged' tool within 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.
    DIFF_STAGED = "git_diff_staged"
  • Usage of the git_diff_staged handler within the main @server.call_tool() dispatcher, formatting and returning the result as TextContent.
    case GitTools.DIFF_STAGED: diff = git_diff_staged(repo) return [TextContent( type="text", text=f"Staged changes:\n{diff}" )]

Other Tools

Related 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