Skip to main content
Glama
archish9

GitHub MCP Server

by archish9

commit_all_changes

Stage all changes and create a commit with a descriptive message to save project progress. Automatically initializes the repository if needed and returns the commit SHA.

Instructions

Stage ALL changes (including untracked files) and create a commit.

This tool acts as a "save point" for the project. It performs the equivalent of:

  1. git add -A (Stages all modified, deleted, and new files)

  2. git commit -m "message"

It will automatically initialize the repository if it hasn't been initialized yet.

Args: repo_path: The absolute path to the repository. message: A descriptive commit message. Common prefixes: 'feat:', 'fix:', 'docs:', 'refactor:', 'test:'.

Returns: The SHA (full hash) of the new commit, or a message indicating "No changes to commit" if the working directory was clean.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes
messageYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The commit_all_changes MCP tool handler. This async function stages all changes (including untracked files) and creates a commit. It uses the @mcp.tool() decorator for registration and calls GitManager.commit_all() to perform the actual git operations.
    async def commit_all_changes(
        repo_path: str,
        message: str,
    ) -> str:
        """Stage ALL changes (including untracked files) and create a commit.
        
        This tool acts as a "save point" for the project. It performs the equivalent of:
        1. `git add -A` (Stages all modified, deleted, and new files)
        2. `git commit -m "message"`
        
        It will automatically initialize the repository if it hasn't been initialized yet.
        
        Args:
            repo_path: The absolute path to the repository.
            message: A descriptive commit message. 
                     Common prefixes: 'feat:', 'fix:', 'docs:', 'refactor:', 'test:'.
            
        Returns:
            The SHA (full hash) of the new commit, or a message indicating "No changes to commit" 
            if the working directory was clean.
        """
        manager = GitManager(repo_path)
        
        # Lazy initialization for mutating operations
        if not manager.is_initialized():
            manager.initialize(initial_commit=False)
        
        return manager.commit_all(message)
  • The GitManager.commit_all() method that implements the actual git operations. It stages all changes using 'git add -A', checks if there are changes to commit, and creates a commit with the provided message, returning the commit SHA.
    def commit_all(self, message: str) -> str:
        """Stage all changes and commit.
        
        Args:
            message: Commit message
            
        Returns:
            Commit SHA
        """
        repo = self.repo
    
        # Stage all changes
        repo.git.add(A=True)
    
        # Check if there are changes to commit
        if not repo.index.diff("HEAD") and not repo.untracked_files:
            return "No changes to commit"
    
        # Commit
        commit = repo.index.commit(message)
        return commit.hexsha
  • The register_tools function that sets up the MCP server and registers all tools including commit_all_changes. This function is called from server.py to initialize all available MCP tools.
    def register_tools(mcp: FastMCP, default_repo_path: str | None = None):
        """Register all MCP tools on the server.
        
        Args:
            mcp: MCP server instance
            default_repo_path: Default repository path (can be overridden per-call)
        """
        
        def get_manager(repo_path: str | None = None) -> GitManager:
            """Get GitManager for the specified or default repo path."""
            path = repo_path or default_repo_path
            if not path:
                raise ValueError("repo_path is required (no default configured)")
            return GitManager(path)
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing key behavioral traits: it stages all changes (modified, deleted, new files), creates a commit with a message, auto-initializes repos, and returns either a SHA hash or a 'No changes to commit' message. It doesn't mention error cases or side effects like overwriting, but covers the core behavior adequately.

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 appropriately sized and front-loaded: the first sentence states the core action, followed by a metaphor ('save point'), bullet points for steps, and then parameter details. Every sentence adds value without redundancy, and it's structured for easy scanning with clear sections for Args and Returns.

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

Completeness5/5

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

Given the tool's complexity (a multi-step git operation), no annotations, and an output schema (implied by 'Returns' section), the description is complete enough. It covers purpose, behavior, parameters, and return values, addressing gaps from missing annotations. The output schema existence means it doesn't need to detail return formats further.

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

Parameters5/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 fully. It adds significant meaning beyond the schema: it explains repo_path as 'the absolute path to the repository' and provides detailed guidance for message including common prefixes like 'feat:' and 'fix:'. This goes well beyond the basic schema, making parameters clear and actionable.

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

Purpose5/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 with specific verbs ('stage ALL changes' and 'create a commit') and distinguishes it from siblings by emphasizing it handles 'ALL changes (including untracked files)' unlike more specific tools like get_repo_status or generate_commit_message. It explicitly names the equivalent git commands, making the action concrete.

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

Usage Guidelines4/5

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

The description provides clear context for when to use it ('as a "save point" for the project') and mentions it automatically initializes the repository if needed, which addresses a prerequisite. However, it doesn't explicitly state when NOT to use it or compare it to alternatives like using separate stage and commit tools, though the sibling list includes tools like get_repo_status that might be used first.

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/archish9/VersionControlHelperMCP'

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