Skip to main content
Glama

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}" )]

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