Skip to main content
Glama
jolfr

Commit Helper MCP

by jolfr

batch_commit_analysis

Analyze staged changes to organize them into logical commit groups and generate appropriate commit messages for batch operations.

Instructions

Analyze multiple file groups for batch commit operations.

Helps organize staged changes into logical commit groups with appropriate commit messages for each group.

Args: repo_path: Path to git repository file_groups: List of file groups with metadata generate_messages: Whether to generate commit messages for each group

Returns: Dict containing batch commit analysis and suggestions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes
file_groupsYes
generate_messagesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main MCP tool handler for batch_commit_analysis. Decorated with @mcp.tool(), it initializes CommitzenService, analyzes provided file_groups, generates basic commit message suggestions, and returns structured analysis.
    @mcp.tool()
    @handle_errors(log_errors=True)
    def batch_commit_analysis(
        repo_path: str,
        file_groups: List[Dict[str, Any]],
        generate_messages: bool = True
    ) -> Dict[str, Any]:
        """
        Analyze multiple file groups for batch commit operations.
        
        Helps organize staged changes into logical commit groups with
        appropriate commit messages for each group.
        
        Args:
            repo_path: Path to git repository
            file_groups: List of file groups with metadata
            generate_messages: Whether to generate commit messages for each group
            
        Returns:
            Dict containing batch commit analysis and suggestions
        """
        # Initialize service for the specified repository
        try:
            target_service = CommitzenService(repo_path=repo_path)
        except Exception as e:
            raise RepositoryError(
                f"Failed to initialize service for repository '{repo_path}'",
                repo_path=repo_path,
                cause=e
            )
        
        try:
            batch_analysis = []
            
            for i, group in enumerate(file_groups):
                group_files = group.get("files", [])
                group_description = group.get("description", f"Group {i+1}")
                
                if not group_files:
                    continue
                
                # Analyze this group of files
                group_analysis = {
                    "group_id": i,
                    "description": group_description,
                    "files": group_files,
                    "file_count": len(group_files)
                }
                
                if generate_messages:
                    # Generate smart suggestions for this group
                    group_analysis["suggested_messages"] = [
                        {
                            "type": "feat",
                            "subject": f"implement {group_description}",
                            "confidence": 0.7
                        }
                    ]
                
                batch_analysis.append(group_analysis)
            
            return create_success_response({
                "repository_path": repo_path,
                "implementation": target_service.git_implementation,
                "batch_analysis": batch_analysis,
                "total_groups": len(batch_analysis),
                "total_files": sum(group["file_count"] for group in batch_analysis)
            })
        except Exception as e:
            logger.error(f"Failed to analyze batch commits: {e}")
            raise ServiceError(
                f"Failed to analyze batch commits: {e}",
                service_name="batch_commit_analysis",
                cause=e
            )
  • Import statement in main server module that brings the batch_commit_analysis tool into scope, ensuring it's available and registered when the server module is loaded.
    from .server.enhanced_tools import (
        analyze_repository_health,
        get_detailed_diff_analysis,
        get_branch_analysis,
        smart_commit_suggestion,
        batch_commit_analysis,
    )
  • Helper method in CommitOrchestrator class providing more advanced batch commit analysis using Commitizen message generation and validation. Not directly called by the MCP tool but available as a service utility.
    def batch_commit_analysis(
        self,
        repo_path: Optional[str],
        file_groups: List[Dict[str, Any]],
        generate_messages: bool = True,
        **kwargs,
    ) -> Dict[str, Any]:
        """
        Analyze multiple file groups for batch commit operations.
    
        Args:
            repo_path: Repository path
            file_groups: List of file groups with metadata
            generate_messages: Whether to generate commit messages
    
        Returns:
            Dict containing batch analysis and suggestions
        """
        if not self.git_enabled:
            raise RepositoryError("Git operations not available", repo_path=repo_path)
    
        analyzed_groups = []
    
        for group in file_groups:
            group_analysis = {
                "group_id": group.get("id", "unnamed"),
                "files": group.get("files", []),
                "description": group.get("description", ""),
            }
    
            # Generate commit message if requested
            if generate_messages and group.get("type") and group.get("subject"):
                try:
                    message = self.commitizen.generate_message(
                        {
                            "type": group["type"],
                            "subject": group["subject"],
                            "scope": group.get("scope"),
                            "body": group.get("body"),
                            "breaking": group.get("breaking", False),
                            "footer": group.get("footer"),
                        }
                    )
    
                    group_analysis["generated_message"] = message
                    group_analysis["is_valid"] = self.commitizen.validate_message(
                        message
                    )
                except Exception as e:
                    logger.warning(
                        f"Failed to generate message for group {group.get('id')}: {e}"
                    )
                    group_analysis["message_error"] = str(e)
    
            analyzed_groups.append(group_analysis)
    
        return create_success_response(
            {
                "groups": analyzed_groups,
                "total_groups": len(file_groups),
                "valid_messages": len(
                    [g for g in analyzed_groups if g.get("is_valid", False)]
                ),
                "git_enabled": True,
            }
        )
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 of behavioral disclosure. It mentions the tool 'analyzes' and 'helps organize' changes, which suggests a read-only or advisory function, but doesn't clarify if it modifies the repository, requires specific permissions, has side effects, or handles errors. For a tool with no annotations, this leaves significant gaps in understanding its behavior and safety profile.

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: it starts with a clear purpose statement, followed by a helper sentence, then parameter details, and a return statement. Each sentence adds value without redundancy. However, the parameter section could be more integrated into the flow rather than a separate list, slightly affecting structure.

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 3 parameters with 0% schema coverage, no annotations, and an output schema present, the description is moderately complete. It explains the tool's purpose and parameters but lacks behavioral context and usage guidelines. The output schema handles return values, so the description doesn't need to detail them. However, for a tool with no annotations and incomplete parameter semantics, it should do more to guide safe and effective use.

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?

Schema description coverage is 0%, so the description must compensate. It lists parameters in an 'Args' section with brief explanations: 'repo_path: Path to git repository', 'file_groups: List of file groups with metadata', and 'generate_messages: Whether to generate commit messages for each group'. This adds meaning beyond the schema's property titles, but details like 'file_groups' metadata structure or 'repo_path' format are unspecified. The description partially compensates but doesn't fully cover the gap.

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: 'Analyze multiple file groups for batch commit operations' and 'Helps organize staged changes into logical commit groups with appropriate commit messages for each group.' It specifies the verb ('analyze') and resource ('multiple file groups'), distinguishing it from siblings like 'execute_git_commit' or 'stage_files_and_commit'. However, it doesn't explicitly differentiate from similar analysis tools like 'get_branch_analysis' or 'smart_commit_suggestion' beyond the batch focus.

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 for commit-related operations (e.g., 'execute_git_commit', 'generate_commit_message', 'smart_commit_suggestion'), there's no indication of prerequisites, context (e.g., after staging files), or comparisons. The description implies usage for organizing changes but doesn't specify when this analysis is needed over other tools.

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