git_commit
Use this tool to record changes to a Git repository by specifying the repository path and a commit message. It integrates with the MCP Git Server to manage version control tasks efficiently.
Instructions
Records changes to the repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | ||
| repo_path | Yes |
Implementation Reference
- src/mcp_server_git/server.py:89-91 (handler)The core handler function for the git_commit tool. It commits the repository index using the provided message and returns the commit hash.def git_commit(repo: git.Repo, message: str) -> str: commit = repo.index.commit(message) return f"Changes committed successfully with hash {commit.hexsha}"
- src/mcp_server_git/server.py:32-34 (schema)Pydantic schema defining the input parameters for the git_commit tool: repo_path (str) and message (str).class GitCommit(BaseModel): repo_path: str message: str
- src/mcp_server_git/server.py:191-195 (registration)Registration of the git_commit tool (name=GitTools.COMMIT == 'git_commit') in the server's list_tools() method, including schema and description.Tool( name=GitTools.COMMIT, description="Records changes to the repository", inputSchema=GitCommit.schema(), ),
- src/mcp_server_git/server.py:306-311 (registration)The dispatch case in the call_tool handler that invokes the git_commit function with arguments and returns the result as TextContent.case GitTools.COMMIT: result = git_commit(repo, arguments["message"]) return [TextContent( type="text", text=result )]
- src/mcp_server_git/server.py:68-68 (helper)Enum value defining the tool name 'git_commit' used in registration and dispatch.COMMIT = "git_commit"