Skip to main content
Glama

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
NameRequiredDescriptionDefault
messageYes
repo_pathYes

Implementation Reference

  • 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}"
  • 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
  • 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(), ),
  • 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 )]
  • Enum value defining the tool name 'git_commit' used in registration and dispatch.
    COMMIT = "git_commit"

Other Tools

Related Tools

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