generate_commit_message
Generate commit messages from staged git changes with automatic prefix formatting for ticket numbers and branch types.
Instructions
Prepare commit message context from staged changes. Falls back to unstaged working tree changes when nothing is staged, so you can analyze changes before running 'git add'. Check 'source' in the response to see whether staged or unstaged changes were used, and 'hint' for staging instructions.
TWO MODES:
WITH summary parameter (recommended): Returns a ready-to-use commit message. Pass a brief description of what the changes do, and the tool formats it with the proper prefix, capitalization, and validation. Check context.availableSummaryLength to see how many characters your summary can use (prefix uses the rest). When includeBody is true, the diff and changeSummary are provided so YOU can write a meaningful body — the tool does NOT auto-generate the body.
WITHOUT summary: Returns context for YOU to compose the message.
'title' is a best-effort PLACEHOLDER based on file patterns
'changes.diff' contains the actual diff
'changeSummary' groups ALL files by category (Swift source, config, etc.)
'commitGuidelines' explains how to write the message
YOU must analyze the diff and compose a meaningful title and body
For best results: First analyze the staged changes yourself, then call this tool WITH the summary parameter to get a properly formatted commit message.
Prefix behavior:
No prefix on main/master/develop branches
If ticket found: "PROJ-123: message"
If branch type: "Task: message", "Bug: message"
Examples:
"Task: Fix suffix removal for usernames containing -by- substring"
"Bug: Fix HolaSpark loading race condition with ReachabilityState enum"
"WTHRAPP-3104: Update winter weather icons and illustration mappings"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repoPath | No | Path to the git repository. IMPORTANT: Always pass the user's current project/workspace directory. | |
| summary | No | Summary of changes - RECOMMENDED for best results. Tool formats it with proper prefix. | |
| type | No | Optional commit type override (feat, fix, etc.) | |
| scope | No | Optional scope override | |
| includeBody | No | Whether to include a commit body |