Skip to main content
Glama

generate_commit_message

Generate Git commit messages from code changes using conventional, simple, or detailed styles to document version history.

Instructions

根据代码变更生成 Git commit message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
diffYes代码变更内容(git diff 输出)
styleNo提交信息风格:conventional(约定式)、simple(简洁)、detailed(详细)

Implementation Reference

  • MCP tool handler for 'generate_commit_message': extracts diff and style from args, defines style-specific prompts, constructs a prompt for generating commit message from git diff, calls orchestrator.askDynamicExpert with a fast Git expert role, and returns formatted response.
    case 'generate_commit_message': { const { diff, style = 'conventional' } = args as { diff: string; style?: string }; const stylePrompts: Record<string, string> = { conventional: '使用约定式提交格式:type(scope): description。type 可以是 feat/fix/docs/style/refactor/test/chore。', simple: '使用简洁风格:一行描述主要变更。', detailed: '使用详细风格:标题 + 空行 + 详细说明(列出所有变更点)。', }; const prompt = `请根据以下代码变更生成 Git commit message。 ${stylePrompts[style] || stylePrompts.conventional} 代码变更: \`\`\`diff ${diff.slice(0, 8000)} \`\`\` 请只输出 commit message,不要其他内容。`; const response = await orchestrator.askDynamicExpert('fast', '你是一位 Git 提交规范专家。', prompt); return { content: [{ type: 'text', text: `# 📝 推荐的 Commit Message\n\n\`\`\`\n${response}\n\`\`\`` }], }; }
  • Tool registration and input schema definition for 'generate_commit_message', specifying required 'diff' (git diff output) and optional 'style' enum for commit message format.
    { name: 'generate_commit_message', description: '根据代码变更生成 Git commit message', inputSchema: { type: 'object', properties: { diff: { type: 'string', description: '代码变更内容(git diff 输出)', }, style: { type: 'string', enum: ['conventional', 'simple', 'detailed'], description: '提交信息风格:conventional(约定式)、simple(简洁)、detailed(详细)', }, }, required: ['diff'], }, },

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/7836246/claude-team-mcp'

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