Skip to main content
Glama
jolfr

Commit Helper MCP

by jolfr

validate_commit_message

Check if a commit message follows conventional commit rules to maintain consistent project history and enable automated changelogs.

Instructions

Validate an existing commit message against the current plugin's rules.

Args: message: The commit message to validate

Returns: Dict containing validation result and details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP handler function decorated with @mcp.tool() that implements the validate_commit_message tool. It validates the input message using the service facade and returns structured results with validity status, pattern, and plugin information.
    @mcp.tool()
    @handle_errors(log_errors=True)
    def validate_commit_message(message: str) -> Dict[str, Any]:
        """
        Validate an existing commit message against the current plugin's rules.
    
        Args:
            message: The commit message to validate
    
        Returns:
            Dict containing validation result and details
        """
        is_valid = service.validate_message(message)
    
        # Get additional info for context
        info = service.get_info()
        pattern = info.get("pattern")
    
        result = {
            "is_valid": is_valid,
            "message": message,
            "pattern": pattern,
            "plugin": info.get("plugin_name"),
        }
    
        if not is_valid:
            # Return error response but don't raise exception
            # This allows validation to fail gracefully
            return {
                "success": False,
                "is_valid": False,
                "message": message,
                "error": "Commit message does not match required pattern",
                "pattern": pattern,
                "plugin": info.get("plugin_name"),
            }
    
        return create_success_response(result)
  • Core validation logic used by the tool's service.validate_message call. Performs regex matching against the Commitizen committer's pattern or falls back to plugin adapter validation.
    def validate_message(self, message: str) -> bool:
        """Validate commit message format."""
        try:
            # First try plugin validation if available
            if hasattr(self.committer, "pattern"):
                import re
    
                pattern = self.committer.pattern
                is_valid = bool(re.match(pattern, message))
                logger.debug(f"Plugin validation result: {is_valid}")
                return is_valid
            else:
                # Fall back to adapter validation
                is_valid = self.adapter.validate_message(message)
                logger.debug(f"Adapter validation result: {is_valid}")
                return is_valid
        except CommitizenException as e:
            logger.error(f"Failed to validate message: {e}")
            raise ValidationError(
                f"Message validation failed: {e}",
                validation_type="commit_message",
                invalid_value=message,
                cause=e,
            )
        except Exception as e:
            if not isinstance(e, ValidationError):
                logger.error(f"Failed to validate message: {e}")
                raise ValidationError(
                    f"Message validation failed: {e}",
                    validation_type="commit_message",
                    invalid_value=message,
                    cause=e,
                )
            raise
  • Facade method in CommitzenService that delegates validate_message to the underlying CommitzenCore service.
    def validate_message(self, message: str) -> bool:
        """Validate commit message format."""
        return self.commitizen_core.validate_message(message)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool validates against rules but doesn't disclose behavioral traits such as what validation entails (e.g., format checks, rule compliance), error handling, or performance aspects. This is a significant gap for a validation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence clearly states the purpose, followed by structured 'Args' and 'Returns' sections. There's no wasted text, and it efficiently conveys core information in a few lines.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (validation with plugin rules), no annotations, and an output schema present, the description is partially complete. It covers the basic action and parameter but lacks details on validation rules, error cases, or output structure. The output schema mitigates some gaps, but more context on behavior would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal semantics: it names the parameter ('message') and indicates it's 'The commit message to validate.' With 0% schema description coverage and 1 parameter, this provides basic meaning beyond the schema's title ('Message') and type. However, it doesn't elaborate on format, constraints, or examples, leaving gaps in understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Validate an existing commit message against the current plugin's rules.' It specifies the verb (validate), resource (commit message), and context (plugin's rules). However, it doesn't explicitly differentiate from siblings like 'validate_commit_readiness' or 'preview_git_commit', which might have overlapping validation aspects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools related to commits (e.g., 'create_commit_message', 'execute_git_commit', 'validate_commit_readiness'), there's no indication of prerequisites, timing, or comparisons. The context is implied (validating against plugin rules) but lacks explicit usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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