Skip to main content
Glama
jolfr

Commit Helper MCP

by jolfr

create_commit_message

Generate conventional commit messages from structured answers to commit questions, providing validation status for proper formatting.

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
NameRequiredDescriptionDefault
answers_dictYes

Implementation Reference

  • The core handler function decorated with @mcp.tool() that implements the 'create_commit_message' tool logic. It takes a dictionary of answers, generates a commit message using the service, validates it, and returns the result.
    @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)

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/jolfr/commit-helper-mcp'

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