Skip to main content
Glama

git_commit

Create Git commits with custom messages for specified repositories, enabling version control and tracking changes efficiently within the Git Repo Browser MCP environment.

Instructions

Create a commit with the specified message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesThe commit message
repo_pathYesThe path to the local Git repository

Implementation Reference

  • The handler function that executes the git_commit tool. It uses simpleGit to perform the commit on staged changes in the given repository path with the provided message, returning the commit hash and summary on success or an error message.
    export async function handleGitCommit({ repo_path, message }) { try { const git = simpleGit(repo_path); // Create the commit (only commit what's in the staging area) const commitResult = await git.commit(message); return { content: [ { type: "text", text: JSON.stringify( { success: true, commit_hash: commitResult.commit, commit_message: message, summary: commitResult.summary, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( { error: `Failed to create commit: ${error.message}` }, null, 2 ), }, ], isError: true, }; } }
  • The input schema definition for the git_commit tool, specifying repo_path and message as required string parameters.
    { name: "git_commit", description: "Create a commit with the specified message.", inputSchema: { type: "object", properties: { repo_path: { type: "string", description: "The path to the local Git repository", }, message: { type: "string", description: "The commit message", }, }, required: ["repo_path", "message"], }, },
  • src/server.js:907-907 (registration)
    Registers the handleGitCommit function to the 'git_commit' tool name in the handlersMap used by the MCP server to dispatch tool calls.
    git_commit: handleGitCommit,
  • src/server.js:18-18 (registration)
    Imports the handleGitCommit handler from './handlers/index.js' for use in the server.
    handleGitCommit,

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/bsreeram08/git-commands-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server