generate_release_note
Create structured release notes by analyzing differences between Git repository tags. Automatically generates Markdown output highlighting features, improvements, bug fixes, and breaking changes.
Instructions
タグ間の差分からリリースノートを生成します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| breaking | No | 破壊的変更の一覧(オプション) | |
| bugfixes | No | バグ修正の一覧(オプション) | |
| endTag | Yes | 終了タグ | |
| features | No | 新機能の一覧(オプション) | |
| improvements | No | 改善項目の一覧(オプション) | |
| startTag | Yes | 開始タグ | |
| title | No | リリースノートのタイトル(オプション) |
Implementation Reference
- src/index.ts:113-147 (handler)The main handler for the 'generate_release_note' tool. Fetches git diff between tags, generates content using helper, saves markdown file to .iris directory, and returns the file path and content.private async handleGenerateReleaseNote(input: ReleaseNoteInput) { try { // .irisディレクトリの作成 const irisDir = path.join(process.cwd(), '.iris'); await fs.ensureDir(irisDir); // タグ間の差分を取得 const diff = await this.git.diff([input.startTag, input.endTag]); const files = diff.split('diff --git').slice(1); // リリースノートの内容を生成 const content = this.generateReleaseNoteContent(input, files); // ファイル名を生成(タグ名とタイムスタンプを使用) const filename = `release-note-${input.endTag}-${Date.now()}.md`; const filePath = path.join(irisDir, filename); // リリースノートを保存 await fs.writeFile(filePath, content, 'utf-8'); return { content: [ { type: 'text', text: `リリースノートを生成しました: ${filePath}\n\n${content}`, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : '不明なエラーが発生しました'; throw new McpError( ErrorCode.InternalError, `リリースノートの生成に失敗しました: ${errorMessage}` ); }
- src/index.ts:150-207 (helper)Helper function that generates the markdown content for the release note, including sections for breaking changes, features, improvements, bugfixes, and changed files based on input and git diff files.private generateReleaseNoteContent(input: ReleaseNoteInput, files: string[]): string { let content = ''; const title = input.title || `Release ${input.endTag}`; const date = new Date().toISOString().split('T')[0]; content += `# ${title}\n\n`; content += `リリース日: ${date}\n\n`; // 破壊的変更 if (input.breaking && input.breaking.length > 0) { content += '## 💥 破壊的変更\n\n'; input.breaking.forEach(item => { content += `- ${item}\n`; }); content += '\n'; } // 新機能 if (input.features && input.features.length > 0) { content += '## ✨ 新機能\n\n'; input.features.forEach(feature => { content += `- ${feature}\n`; }); content += '\n'; } // 改善項目 if (input.improvements && input.improvements.length > 0) { content += '## 🔧 改善項目\n\n'; input.improvements.forEach(improvement => { content += `- ${improvement}\n`; }); content += '\n'; } // バグ修正 if (input.bugfixes && input.bugfixes.length > 0) { content += '## 🐛 バグ修正\n\n'; input.bugfixes.forEach(bugfix => { content += `- ${bugfix}\n`; }); content += '\n'; } // 変更されたファイル if (files.length > 0) { content += '## 📝 変更されたファイル\n\n'; files.forEach(file => { const match = file.match(/a\/(.*) b\//); if (match) { content += `- \`${match[1]}\`\n`; } }); content += '\n'; } return content; }
- src/index.ts:56-93 (schema)JSON schema defining the input parameters for the 'generate_release_note' tool, including required startTag and endTag, and optional fields for title, features, improvements, bugfixes, and breaking changes.inputSchema: { type: 'object', properties: { startTag: { type: 'string', description: '開始タグ', }, endTag: { type: 'string', description: '終了タグ', }, title: { type: 'string', description: 'リリースノートのタイトル(オプション)', }, features: { type: 'array', items: { type: 'string' }, description: '新機能の一覧(オプション)', }, improvements: { type: 'array', items: { type: 'string' }, description: '改善項目の一覧(オプション)', }, bugfixes: { type: 'array', items: { type: 'string' }, description: 'バグ修正の一覧(オプション)', }, breaking: { type: 'array', items: { type: 'string' }, description: '破壊的変更の一覧(オプション)', }, }, required: ['startTag', 'endTag'], },
- src/index.ts:51-96 (registration)Registers the 'generate_release_note' tool in the MCP ListToolsRequestSchema handler, providing name, description, and input schema.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ { name: 'generate_release_note', description: 'タグ間の差分からリリースノートを生成します', inputSchema: { type: 'object', properties: { startTag: { type: 'string', description: '開始タグ', }, endTag: { type: 'string', description: '終了タグ', }, title: { type: 'string', description: 'リリースノートのタイトル(オプション)', }, features: { type: 'array', items: { type: 'string' }, description: '新機能の一覧(オプション)', }, improvements: { type: 'array', items: { type: 'string' }, description: '改善項目の一覧(オプション)', }, bugfixes: { type: 'array', items: { type: 'string' }, description: 'バグ修正の一覧(オプション)', }, breaking: { type: 'array', items: { type: 'string' }, description: '破壊的変更の一覧(オプション)', }, }, required: ['startTag', 'endTag'], }, }, ], }));
- src/index.ts:97-111 (registration)Registers the CallToolRequestSchema handler, which dispatches calls to 'generate_release_note' to the handleGenerateReleaseNote function after basic validation.this.server.setRequestHandler(CallToolRequestSchema, async (request) => { if (request.params.name === 'generate_release_note') { const input = request.params.arguments as unknown as ReleaseNoteInput; if (!input.startTag || !input.endTag) { throw new McpError( ErrorCode.InvalidParams, 'startTagとendTagは必須パラメータです' ); } return await this.handleGenerateReleaseNote(input); } throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}`); }); }