git_reset
Unstage all changes that have been staged for commit, reverting the staging area to the last commit state.
Instructions
Unstages all staged changes
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes |
Implementation Reference
- The handler function for git_reset tool. Calls repo.index.reset() to unstage all staged changes and returns a confirmation string.
def git_reset(repo: git.Repo) -> str: repo.index.reset() return "All staged changes reset" - Pydantic model defining the input schema for git_reset tool. Only requires a repo_path string parameter.
class GitReset(BaseModel): repo_path: str - src/git/src/mcp_server_git/server.py:96-103 (registration)Enum member RESET with value 'git_reset', used as the tool name identifier for registration and dispatch.
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" - src/git/src/mcp_server_git/server.py:375-384 (registration)Tool registration in the list_tools() function, declaring the git_reset tool with its description, schema, and annotations (destructive, idempotent).
Tool( name=GitTools.RESET, description="Unstages all staged changes", inputSchema=GitReset.model_json_schema(), annotations=ToolAnnotations( readOnlyHint=False, destructiveHint=True, idempotentHint=True, openWorldHint=False, ), - src/git/src/mcp_server_git/server.py:525-530 (registration)Dispatch call in the call_tool() handler. When name matches GitTools.RESET ('git_reset'), it calls the git_reset function with the repo and returns the result as text content.
case GitTools.RESET: result = git_reset(repo) return [TextContent( type="text", text=result )]