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
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes |
Implementation Reference
- src/mcp_server_git/server.py:80-82 (handler)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()
- src/mcp_server_git/server.py:22-24 (schema)Pydantic schema defining the input for git_diff_unstaged tool: requires repo_path.class GitDiffUnstaged(BaseModel): repo_path: str
- src/mcp_server_git/server.py:177-181 (registration)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(
- src/mcp_server_git/server.py:63-75 (registration)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"
- src/mcp_server_git/server.py:285-290 (handler)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}" )]