generate_release_notes
Generate formatted release notes from GitHub commits within specified timeframes or commit ranges, organizing changes by type and including statistics.
Instructions
Generate release notes from commits in a given timeframe or commit range
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | ||
| repo | Yes | ||
| timeRange | No | ||
| commitRange | No | ||
| format | No |
Implementation Reference
- Core handler function that generates formatted release notes (markdown, json, or text) from enriched commit data, handling grouping, stats, and breaking changes.export function generateReleaseNotes( commits: ParsedCommit[], options: { version?: string; groupBy?: 'type' | 'scope' | 'author'; format?: 'markdown' | 'json' | 'text'; includeStats?: boolean; template?: string; } = {} ): string { const { version, groupBy = 'type', format = 'markdown', includeStats = false } = options; // Separate breaking changes const breakingChanges = commits.filter(c => c.breaking); const regularCommits = commits.filter(c => !c.breaking); const releaseNotes: ReleaseNotes = { version, date: new Date().toISOString(), breakingChanges, commits: regularCommits, stats: includeStats ? calculateStats(commits) : undefined }; switch (format) { case 'markdown': return generateMarkdown(releaseNotes, groupBy); case 'json': return JSON.stringify(releaseNotes, null, 2); case 'text': return generatePlainText(releaseNotes, groupBy); default: throw new Error(`Unsupported format: ${format}`); } }
- src/release-notes-server/index.ts:58-89 (handler)Server-side execution handler for the tool: parses args, fetches/enriches GitHub commits, and calls the core generateReleaseNotes function.case 'generate_release_notes': { const args = GenerateNotesSchema.parse(request.params.arguments); // Fetch commits based on time range or commit range // Try to get version from package.json const version = await getVersionFromPackageJson(args.owner, args.repo); const commits = await fetchCommits( args.owner, args.repo, args.timeRange?.from, args.timeRange?.to, args.commitRange?.fromCommit, args.commitRange?.toCommit ); // Enrich commits with PR data const enrichedCommits = await enrichCommitsWithPRData(args.owner, args.repo, commits); // Generate release notes const notes = generateReleaseNotes(enrichedCommits, { format: args.format?.type, groupBy: args.format?.groupBy, includeStats: args.format?.includeStats, template: args.format?.template ? templates[args.format.template] : undefined, version, }); return { content: [{ type: 'text', text: notes }], }; }
- src/release-notes-server/index.ts:37-41 (registration)Tool registration entry in the MCP server's listTools response.{ name: 'generate_release_notes', description: 'Generate release notes from commits in a given timeframe or commit range', inputSchema: zodToJsonSchema(GenerateNotesSchema), },
- Zod schema defining the input parameters for the generate_release_notes tool, including repo details, ranges, and formatting options.export const GenerateNotesSchema = z.object({ owner: z.string(), repo: z.string(), timeRange: TimeRangeSchema.optional(), commitRange: CommitRangeSchema.optional(), format: FormatOptionsSchema.default({}) });