Skip to main content
Glama

git_commit_guided

Guide developers through creating structured Git commits with proper formatting and conventions for clear version history.

Instructions

Guide through creating a proper commit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function for the git_commit_guided tool. It validates the commit message length, optionally stages all changes with 'git add -A', checks if there are staged files using 'git diff --cached', performs the commit, and returns success message with next steps.
    async ({ message, stage_all }) => {
      // Validate commit message
      if (!message || message.length < 10) {
        return { content: [{ type: "text", text: "Commit message should be at least 10 characters.\n\nGood commit message format:\n- feat: add user login feature\n- fix: resolve null pointer in checkout\n- docs: update README setup instructions\n- refactor: simplify payment processing" }] };
      }
    
      let output = "";
    
      if (stage_all) {
        const stageResult = await runCommand("git add -A");
        if (!stageResult.success) {
          return { content: [{ type: "text", text: `Failed to stage: ${stageResult.error}` }] };
        }
        output += "Staged all changes.\n";
      }
    
      // Check if there's anything to commit
      const statusResult = await runCommand("git diff --cached --name-only");
      if (!statusResult.stdout) {
        return { content: [{ type: "text", text: "Nothing staged to commit.\n\nFirst stage your changes:\n  git add <file>     - stage specific file\n  git add -A         - stage all changes" }] };
      }
    
      output += `Files to be committed:\n${statusResult.stdout}\n\n`;
    
      const commitResult = await runCommand(`git commit -m "${message.replace(/"/g, '\\"')}"`);
      if (!commitResult.success) {
        return { content: [{ type: "text", text: `Commit failed: ${commitResult.error}\n${commitResult.stderr}` }] };
      }
    
      output += `Committed successfully!\n\n`;
      output += `Next steps:\n`;
      output += `1. Push to remote: git push origin <branch-name>\n`;
      output += `2. Create a PR: gh pr create\n`;
    
      return { content: [{ type: "text", text: output }] };
    }
  • The input schema (parameters) for the git_commit_guided tool, defining 'message' as required string and 'stage_all' as optional boolean.
    {
      message: { type: "string", description: "Commit message" },
      stage_all: { type: "boolean", description: "Stage all changes first", default: false }
    },
  • src/index.js:105-148 (registration)
    The MCP server.tool registration call for 'git_commit_guided', providing name, description, input schema, and inline handler function.
    server.tool(
      "git_commit_guided",
      "Guide through creating a proper commit",
      {
        message: { type: "string", description: "Commit message" },
        stage_all: { type: "boolean", description: "Stage all changes first", default: false }
      },
      async ({ message, stage_all }) => {
        // Validate commit message
        if (!message || message.length < 10) {
          return { content: [{ type: "text", text: "Commit message should be at least 10 characters.\n\nGood commit message format:\n- feat: add user login feature\n- fix: resolve null pointer in checkout\n- docs: update README setup instructions\n- refactor: simplify payment processing" }] };
        }
    
        let output = "";
    
        if (stage_all) {
          const stageResult = await runCommand("git add -A");
          if (!stageResult.success) {
            return { content: [{ type: "text", text: `Failed to stage: ${stageResult.error}` }] };
          }
          output += "Staged all changes.\n";
        }
    
        // Check if there's anything to commit
        const statusResult = await runCommand("git diff --cached --name-only");
        if (!statusResult.stdout) {
          return { content: [{ type: "text", text: "Nothing staged to commit.\n\nFirst stage your changes:\n  git add <file>     - stage specific file\n  git add -A         - stage all changes" }] };
        }
    
        output += `Files to be committed:\n${statusResult.stdout}\n\n`;
    
        const commitResult = await runCommand(`git commit -m "${message.replace(/"/g, '\\"')}"`);
        if (!commitResult.success) {
          return { content: [{ type: "text", text: `Commit failed: ${commitResult.error}\n${commitResult.stderr}` }] };
        }
    
        output += `Committed successfully!\n\n`;
        output += `Next steps:\n`;
        output += `1. Push to remote: git push origin <branch-name>\n`;
        output += `2. Create a PR: gh pr create\n`;
    
        return { content: [{ type: "text", text: output }] };
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Guide through' suggests an interactive or step-by-step process, but it doesn't reveal key traits like whether it modifies files, requires user input, has side effects (e.g., creating commits automatically), or handles errors. This is inadequate for a tool with zero annotation coverage.

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, efficient sentence with zero waste. It's front-loaded with the core purpose ('Guide through creating a proper commit'), and every word contributes meaning without redundancy. This is optimally concise for the given information.

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?

Given the complexity (a guidance tool likely involving user interaction) and lack of annotations/output schema, the description is incomplete. It doesn't explain what 'proper' entails, how guidance is provided, what the output or result looks like, or any behavioral nuances. This leaves significant gaps for an agent to understand and invoke the tool correctly.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add param info, which is acceptable here. Baseline is 4 since the schema fully covers the absence of parameters, and the description doesn't need to compensate.

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

Purpose3/5

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

The description 'Guide through creating a proper commit' states a general purpose (guiding commit creation) but lacks specificity about what 'proper' means or how the guidance is delivered. It distinguishes from siblings like 'git_branch_explained' and 'git_status_explained' by focusing on commits rather than branches or status, but doesn't clarify the verb 'guide' (e.g., interactive prompts, validation, or examples).

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?

No explicit guidance on when to use this tool versus alternatives is provided. The description implies usage during commit creation, but it doesn't specify prerequisites (e.g., after staging changes), exclusions (e.g., not for automated commits), or alternatives among siblings (e.g., if other git tools exist for different tasks). This leaves the agent with minimal context for selection.

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/rideRTD/RTD-DevOps'

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