create_commit_message
Generate and validate conventional commit messages using input answers to standard commit questions, streamlining version control workflows with structured, AI-assisted commit messages.
Instructions
Generate a commit message from a complete answers dictionary.
Args: answers_dict: Dictionary containing all answers to commit questions
Returns: Dict containing the generated message and validation status
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| answers_dict | Yes |
Implementation Reference
- The MCP tool handler for 'create_commit_message'. It takes a dictionary of commit answers, generates a commit message using the service, validates it, and returns a success response with the message and validation status.@mcp.tool() @handle_errors(log_errors=True) def create_commit_message(answers_dict: Dict[str, Any]) -> Dict[str, Any]: """ Generate a commit message from a complete answers dictionary. Args: answers_dict: Dictionary containing all answers to commit questions Returns: Dict containing the generated message and validation status """ # Check for required fields if "type" not in answers_dict or "subject" not in answers_dict: raise create_validation_error( "Missing required fields in answers dictionary", validation_type="commit_answers", invalid_value=str(answers_dict.keys()), ) # Generate the message using the service message = service.generate_message(answers_dict) # Validate the generated message is_valid = service.validate_message(message) if not is_valid: raise create_validation_error( "Generated message failed validation", validation_type="commit_message", invalid_value=message, ) result = {"message": message, "is_valid": is_valid, "answers": answers_dict} return create_success_response(result)