get_enhanced_git_status
Retrieve detailed Git repository status including file changes, commit history, and repository analytics to support commit message generation and validation.
Instructions
Get enhanced git repository status with detailed information.
Uses GitPython features when available for richer information:
Detailed file status (staged, unstaged, untracked)
Recent commit history with statistics
Repository analytics (total commits, branches, tags)
Current branch and HEAD information
Args: repo_path: Path to git repository
Returns: Dict containing enhanced repository status
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes |
Implementation Reference
- The MCP tool handler function for 'get_enhanced_git_status'. Decorated with @mcp.tool(), it initializes a CommitzenService for the given repo_path, retrieves the repository status, adds enhanced metadata, and returns a formatted success response.@mcp.tool() @handle_errors(log_errors=True) def get_enhanced_git_status(repo_path: str) -> Dict[str, Any]: """ Get enhanced git repository status with detailed information. Uses GitPython features when available for richer information: - Detailed file status (staged, unstaged, untracked) - Recent commit history with statistics - Repository analytics (total commits, branches, tags) - Current branch and HEAD information Args: repo_path: Path to git repository Returns: Dict containing enhanced repository status """ # Initialize service with specific 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, ) if not target_service.git_enabled: raise RepositoryError( "Git operations not available - not in a git repository", repo_path=repo_path, ) status = target_service.get_repository_status() if "error" in status: raise GitOperationError(status["error"], repo_path=repo_path) status["enhanced_features_used"] = True status["implementation"] = target_service.git_implementation return create_success_response( {"repository_status": status, "repository_path": repo_path} )
- src/commit_helper_mcp/mcp_server.py:14-14 (registration)Import of the git_tools module in the main MCP server file, which executes the @mcp.tool() decorators to register the get_enhanced_git_status tool.from .server import git_tools
- src/commit_helper_mcp/mcp_server.py:34-43 (registration)Explicit import of the get_enhanced_git_status function from git_tools for use and export in the main server module.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, )