Skip to main content
Glama
Sunwood-ai-labs

aira-mcp-server

create_commit

Create and execute a commit for a specific file in a Git repository, specifying type, emoji, title, and optional details like body, footer, and GitHub issue number.

Instructions

指定したファイルに対してコミットを作成・実行します。※1度に1ファイルのみコミット可能です

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyNoコミットの本文(オプション)
emojiYesコミットメッセージに使用する絵文字
fileYesコミット対象のファイルパス(1ファイルのみ指定可能)
footerNoコミットのフッター(オプション)
issueNumberNoGitHub Issue番号(オプション)
languageNoコミットメッセージの言語(デフォルト: ja)
pathYesGitリポジトリの絶対パス
titleYesコミットのタイトル
typeYesコミットの種類

Implementation Reference

  • The core handler factory for the 'create_commit' tool. It defines the inputSchema, validates arguments using isCreateCommitArgs, executes gitService.createCommit, and formats the response.
    export function createCreateCommitHandler(gitService: GitService): ToolHandler {
      return {
        name: "create_commit",
        description: "指定したファイルに対してコミットを作成・実行します。※1度に1ファイルのみコミット可能です",
        inputSchema: {
          type: "object",
          properties: {
            file: {
              type: "string",
              description: "コミット対象のファイルパス(1ファイルのみ指定可能)"
            },
            path: {
              type: "string",
              description: "Gitリポジトリの絶対パス"
            },
            type: {
              type: "string",
              enum: Object.keys(COMMIT_TYPES),
              description: "コミットの種類"
            },
            emoji: {
              type: "string",
              description: "コミットメッセージに使用する絵文字"
            },
            title: {
              type: "string",
              description: "コミットのタイトル"
            },
            body: {
              type: "string",
              description: "コミットの本文(オプション)"
            },
            footer: {
              type: "string",
              description: "コミットのフッター(オプション)"
            },
            language: {
              type: "string",
              enum: ["ja", "en"],
              description: "コミットメッセージの言語(デフォルト: ja)"
            },
            issueNumber: {
              type: "number",
              description: "GitHub Issue番号(オプション)"
            }
          },
          required: ["file", "path", "type", "emoji", "title"]
        },
        handler: async (args) => {
          if (!isCreateCommitArgs(args)) {
            throw new McpError(
              ErrorCode.InvalidParams,
              "Invalid arguments: file, path, type, emoji, and title are required"
            );
          }
    
          try {
            const commitMessage = await gitService.createCommit(args);
            return {
              content: [{
                type: "text",
                text: `Successfully committed ${args.file} with message:\n${commitMessage}`
              }]
            };
          } catch (error) {
            if (error instanceof McpError) {
              throw error;
            }
            throw new McpError(
              ErrorCode.InternalError,
              `Failed to create commit: ${error}`
            );
          }
        }
      };
    }
  • Registration of the 'create_commit' handler in the ToolHandlers class's internal map.
    this.handlers = new Map([
      ['get_status', createGetStatusHandler(gitService)],
      ['create_commit', createCreateCommitHandler(gitService)]
    ]);
  • TypeScript interface and type guard for CreateCommitArgs, used for input validation in the handler.
    export interface CreateCommitArgs {
      file: string;  // 単一ファイルのみを受け付ける
      path: string;  // Gitリポジトリの絶対パス
      type: CommitType;
      emoji: string;
      title: string;
      body?: string;
      footer?: string;
      language?: 'ja' | 'en';
      branch?: string;
      issueNumber?: number;  // GitHub Issue番号(オプション)
    }
    
    export function isCreateCommitArgs(obj: unknown): obj is CreateCommitArgs {
      if (typeof obj !== 'object' || obj === null) return false;
      const args = obj as Record<string, unknown>;
      return (
        typeof args.file === 'string' &&
        typeof args.path === 'string' &&
        typeof args.type === 'string' &&
        typeof args.emoji === 'string' &&
        typeof args.title === 'string' &&
        (args.body === undefined || typeof args.body === 'string') &&
        (args.footer === undefined || typeof args.footer === 'string') &&
        (args.language === undefined || ['ja', 'en'].includes(args.language as string)) &&
        (args.branch === undefined || typeof args.branch === 'string') &&
        (args.issueNumber === undefined || typeof args.issueNumber === 'number')
      );
    }
  • src/index.ts:50-52 (registration)
    Routing for 'create_commit' tool call in the main MCP server request handler switch statement.
    case "create_commit":
      response = await toolHandlers.handleCreateCommit(request.params.arguments);
      break;
  • Core implementation of commit creation: stages file if needed, generates message, executes git commit command.
    async createCommit(args: CreateCommitArgs & { path?: string }): Promise<string> {
      try {
        const targetBranch = args.branch || 'develop';
        const workingDir = args.path || process.cwd();
    
        // ファイルのステージング状態を確認し、必要に応じてステージング
        if (!(await this.statusManager.isFileStaged(args.file, workingDir))) {
          await this.statusManager.stageFile(args.file, workingDir);
          console.log(`Automatically staged file: ${args.file}`);
        }
    
        // コミットメッセージの生成とコミット実行
        const commitMessage = this.generateCommitMessage(args);
        await this.gitExecutor.execGitWithError(
          `commit -m "${commitMessage}" -- "${args.file}"`,
          workingDir
        );
    
        return `[${targetBranch}] ${commitMessage}`;
      } catch (error) {
        if (error instanceof McpError) throw error;
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to create commit: ${error}`
        );
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the 'create/execute' action and the single-file constraint, but lacks details on permissions needed, whether changes are reversible, error handling, or rate limits. For a mutation tool with zero annotation coverage, this is a significant gap.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the core purpose. Every word contributes meaning, with no wasted text. It could potentially be slightly more structured but remains highly concise.

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

Completeness3/5

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

Given the tool's complexity (9 parameters, mutation operation) and lack of both annotations and output schema, the description is incomplete. It covers the basic action and constraint but misses critical behavioral context like permissions, error cases, and return values. The schema handles parameters well, but the description doesn't compensate for other gaps.

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 fully documents all 9 parameters. The description adds no parameter-specific information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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/execute a commit') and resource ('for specified files'), with the specific constraint 'only one file at a time'. It distinguishes from the sibling 'get_status' by being a write operation versus a read operation. However, it doesn't explicitly name the sibling as an alternative.

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

Usage Guidelines3/5

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

The description implies usage context through the constraint 'only one file at a time', which suggests when to use this tool versus alternatives that might handle multiple files. However, it doesn't explicitly state when-not-to-use scenarios or name specific alternatives beyond the general sibling distinction.

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

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/Sunwood-ai-labs/aira-mcp-server'

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