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
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes |
Implementation Reference
- src/mcp_server_git/server.py:83-84 (handler)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")
- src/mcp_server_git/server.py:25-26 (schema)Pydantic BaseModel defining the input schema for the git_diff_staged tool, which requires a repo_path string.class GitDiffStaged(BaseModel): repo_path: str
- src/mcp_server_git/server.py:181-185 (registration)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(), ),
- src/mcp_server_git/server.py:66-66 (registration)Enum constant defining the tool name 'git_diff_staged' within GitTools enum.DIFF_STAGED = "git_diff_staged"
- src/mcp_server_git/server.py:292-297 (helper)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}" )]