Skip to main content
Glama
jolfr

Commit Helper MCP

by jolfr

get_git_status

Check Git repository status and view staged files to prepare for committing changes in the Commit Helper MCP server.

Instructions

Get current git repository status and staged files.

Args: repo_path: Path to git repository

Returns: Dict containing: - git_enabled: Whether git operations are available - staged_files: List of staged file paths - staged_count: Number of staged files - repository_path: Path to git repository - repository_status: Additional status information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_git_status' MCP tool. It initializes a CommitzenService for the given repo_path, retrieves the repository status, and returns a formatted dictionary with git status information including staged files. Includes comprehensive error handling and backward compatibility fields.
    @mcp.tool()
    @handle_errors(log_errors=True)
    def get_git_status(repo_path: str) -> Dict[str, Any]:
        """
        Get current git repository status and staged files.
    
        Args:
            repo_path: Path to git repository
    
        Returns:
            Dict containing:
            - git_enabled: Whether git operations are available
            - staged_files: List of staged file paths
            - staged_count: Number of staged files
            - repository_path: Path to git repository
            - repository_status: Additional status information
        """
        # For backward compatibility with tests expecting git_enabled field
        try:
            # Initialize service for the specified repository
            try:
                target_service = CommitzenService(repo_path=repo_path)
            except Exception as e:
                return {
                    "git_enabled": False,
                    "error": f"Failed to initialize service for repository '{repo_path}': {e}",
                    "staged_files": [],
                    "staged_count": 0,
                    "repository_path": repo_path,
                }
    
            if not target_service.git_enabled:
                return {
                    "git_enabled": False,
                    "error": "Git operations not available - not in a git repository",
                    "staged_files": [],
                    "staged_count": 0,
                    "repository_path": repo_path,
                }
    
            status = target_service.get_repository_status()
    
            return {
                "git_enabled": True,
                "staged_files": status.get("staged_files", []),
                "staged_count": status.get("staged_files_count", 0),
                "repository_path": status.get("repository_path"),
                "staging_clean": status.get("staging_clean", True),
                "repository_status": status,
                "success": True,
            }
    
        except Exception as e:
            logger.error(f"Failed to get git status: {e}")
            return {
                "git_enabled": False,
                "error": str(e),
                "staged_files": [],
                "staged_count": 0,
                "repository_path": repo_path,
                "success": False,
            }
  • Module imports that trigger registration of all MCP tools via @mcp.tool() decorators, including git_tools.py which contains get_git_status.
    from .server import message_tools
    from .server import git_tools
    from .server import workflow_tools
    from .server import enhanced_tools
    from .server import resources
  • Explicit re-export of git tools including get_git_status for backward compatibility and module API.
    # Git tools
    from .server.git_tools import (
        get_git_implementation_info,
        get_enhanced_git_status,
        get_git_status,
        preview_git_commit,
        execute_git_commit,
        generate_and_commit,
        validate_commit_readiness,
        stage_files_and_commit,
    )
  • Docstring providing input/output schema description for the tool.
    """
    Get current git repository status and staged files.
    
    Args:
        repo_path: Path to git repository
    
    Returns:
        Dict containing:
        - git_enabled: Whether git operations are available
        - staged_files: List of staged file paths
        - staged_count: Number of staged files
        - repository_path: Path to git repository
        - repository_status: Additional status information
    """
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 states what the tool returns but doesn't cover key aspects like error handling (e.g., what happens if the repo_path is invalid), performance considerations, or whether it requires specific git configurations. This leaves gaps in understanding how the tool behaves in edge cases.

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

Conciseness5/5

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

The description is well-structured and front-loaded, starting with a clear purpose statement followed by organized sections for Args and Returns. Every sentence adds value without redundancy, making it easy to scan and understand quickly.

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

Completeness4/5

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

Given the tool's low complexity (1 parameter) and the presence of an output schema (implied by the Returns section), the description is reasonably complete. It covers the purpose, parameter, and return values adequately. However, without annotations, it could benefit from more behavioral context, such as error handling or usage prerequisites.

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

Parameters4/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 adds meaning by explaining 'repo_path: Path to git repository', which clarifies the parameter's purpose beyond the schema's basic title. However, it doesn't provide details like format examples (e.g., absolute vs. relative paths) or constraints, leaving some ambiguity.

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: 'Get current git repository status and staged files.' It specifies the verb ('Get') and resource ('git repository status and staged files'), making the function evident. However, it doesn't differentiate from sibling tools like 'get_enhanced_git_status', which might offer more detailed status information.

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 siblings like 'get_enhanced_git_status' and 'get_detailed_diff_analysis', it's unclear if this is a basic status check or if other tools should be preferred for more comprehensive analysis. No context or exclusions are mentioned.

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