Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

git_commit

Create Git commits with staged changes using custom messages, amend previous commits, and optionally skip pre-commit hooks for version control management.

Instructions

Create a commit with staged changes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesCommit message
cwdNoRepository directory
amendNoAmend previous commit
noVerifyNoSkip pre-commit hooks

Implementation Reference

  • The main handler function for the git_commit tool. It constructs and executes the git commit command with options for amending and skipping hooks, using the shared executeGitCommand helper.
    export async function gitCommit(args: z.infer<typeof gitCommitSchema>): Promise<ToolResponse> {
      const amendFlag = args.amend ? '--amend' : '';
      const noVerifyFlag = args.noVerify ? '--no-verify' : '';
      // Escape message for shell
      const escapedMessage = args.message.replace(/'/g, "'\\''");
      return executeGitCommand(`git commit ${amendFlag} ${noVerifyFlag} -m '${escapedMessage}'`, args.cwd);
    }
  • Zod schema used for input validation of the git_commit tool parameters.
    export const gitCommitSchema = z.object({
      message: z.string().describe('Commit message'),
      cwd: z.string().optional().describe('Repository directory'),
      amend: z.boolean().optional().default(false).describe('Amend previous commit'),
      noVerify: z.boolean().optional().default(false).describe('Skip pre-commit hooks')
    });
  • src/index.ts:365-368 (registration)
    MCP server dispatch logic that handles calls to 'git_commit' by validating inputs with gitCommitSchema and invoking the gitCommit handler.
    if (name === 'git_commit') {
      const validated = gitCommitSchema.parse(args);
      return await gitCommit(validated);
    }
  • Tool metadata registration in the gitTools array, used by MCP server for listing available tools including name, description, and JSON schema.
    {
      name: 'git_commit',
      description: 'Create a commit with staged changes',
      inputSchema: {
        type: 'object',
        properties: {
          message: { type: 'string', description: 'Commit message' },
          cwd: { type: 'string', description: 'Repository directory' },
          amend: { type: 'boolean', default: false, description: 'Amend previous commit' },
          noVerify: { type: 'boolean', default: false, description: 'Skip pre-commit hooks' }
        },
        required: ['message']
      }
    },
  • Shared utility function used by all git tools, including gitCommit, to execute git commands asynchronously with proper error handling and JSON-formatted responses.
    async function executeGitCommand(command: string, cwd?: string): Promise<ToolResponse> {
      try {
        const { stdout, stderr } = await execAsync(command, {
          cwd: cwd || process.cwd(),
          shell: '/bin/bash',
          maxBuffer: 10 * 1024 * 1024 // 10MB buffer
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: true,
                command: command,
                stdout: stdout.trim(),
                stderr: stderr.trim(),
                cwd: cwd || process.cwd()
              }, null, 2)
            }
          ]
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: false,
                command: command,
                stdout: error.stdout?.trim() || '',
                stderr: error.stderr?.trim() || error.message,
                exitCode: error.code || 1,
                cwd: cwd || process.cwd()
              }, null, 2)
            }
          ],
          isError: true
        };
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Create a commit') but doesn't cover critical aspects like what happens if there are no staged changes, whether it's a destructive operation, authentication requirements, or error conditions. This leaves significant gaps for an agent to understand the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. It's front-loaded with the core action and efficiently communicates the essential purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the commit operation entails, potential side effects, or what constitutes success/failure. Given the complexity of git operations and lack of structured behavioral hints, more context is needed for an agent to use this tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional parameter semantics beyond implying staged changes are involved, which is already covered by the tool's purpose. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create a commit') and the target ('with staged changes'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like git_merge or git_revert, which also involve commit operations but with different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing staged changes via git_add), nor does it differentiate from similar git operations like git_commit --amend (handled via the amend parameter) or other commit-related tools in the sibling list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/ConnorBoetig-dev/mcp2'

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