Skip to main content
Glama
MementoRC

MCP Git Server

by MementoRC

git_pull

Synchronize local repository with remote changes by pulling updates from a specified branch using the MCP Git Server. Simplify version control for Git-based projects.

Instructions

Pull changes from remote repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
branchNo
remoteNoorigin
repo_pathYes

Implementation Reference

  • The core handler function that executes the git pull operation using GitPython's repo.git.pull method, with error handling for authentication and conflicts.
    def git_pull(repo: Repo, remote: str = "origin", branch: str | None = None) -> str:
        """Pull changes from remote repository"""
        try:
            # Get current branch if not specified
            if not branch:
                try:
                    branch = repo.active_branch.name
                except TypeError:  # Detached HEAD or no commits
                    return "❌ No active branch found and no branch specified"
    
            # Perform pull
            if branch:
                result = repo.git.pull(remote, branch)
            else:
                result = repo.git.pull(remote)
    
            return f"✅ Successfully pulled from {remote}/{branch}\n{result}"
    
        except GitCommandError as e:
            if "Authentication failed" in str(e):
                return f"❌ Authentication failed. Check credentials for {remote}"
            elif "merge conflict" in str(e).lower():
                return "❌ Pull failed due to merge conflicts. Resolve conflicts and retry"
            else:
                return f"❌ Pull failed: {str(e)}"
        except Exception as e:
            return f"❌ Pull error: {str(e)}"
  • Pydantic schema/model defining the input parameters for the git_pull tool: repo_path (required), remote (default 'origin'), branch (optional).
    class GitPull(BaseModel):
        repo_path: str
        remote: str = "origin"
        branch: str | None = None
  • Registration of the git_pull tool handler in the GitToolRouter, wrapping the git_pull function from operations.py with error handling and repo validation.
    "git_pull": self._create_git_handler(
        git_pull, requires_repo=True, extra_args=["remote", "branch"]
    ),
  • ToolDefinition registration in the ToolRegistry for 'git_pull' (GitTools.PULL), associating the schema and metadata; handler set later by router.
    ToolDefinition(
        name=GitTools.PULL,
        category=ToolCategory.GIT,
        description="Pull changes from remote repository",
        schema=GitPull,
        handler=placeholder_handler,
        requires_repo=True,
    ),
  • Protected wrapper for git_pull that adds repository binding validation and remote contamination checks before calling the core git_pull function.
    async def protected_git_pull(
        self, repo_path: str, remote: str = "origin", branch: str | None = None
    ) -> str:
        """Git pull with repository binding protection."""
        validated_path = await self._validate_and_prepare_operation(repo_path)
    
        # Additional remote validation for pull operations
        binding = self.binding_manager.binding
        if binding and remote == binding.remote_name:
            current_remote = await self._get_current_remote_url(validated_path)
            if current_remote != binding.expected_remote_url:
                raise RemoteContaminationError(
                    f"Cannot pull: remote {remote} has been contaminated!\n"
                    f"Expected: {binding.expected_remote_url}\n"
                    f"Current: {current_remote}"
                )
    
        logger.info(
            f"Protected pull: {validated_path} <- {remote}/{branch or 'current'}"
        )
    
        repo = Repo(validated_path)
        return git_pull(repo, remote, branch)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('pull changes') but lacks critical details: whether it performs a merge or fast-forward, what happens on conflicts, if it updates remote tracking branches, authentication requirements, or error conditions. This is a significant gap for a mutation 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.

Conciseness5/5

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

The description is a single, efficient sentence with zero wasted words. It's front-loaded with the core action ('pull changes') and specifies the source ('from remote repository'). Every word earns its place, making it easy to parse quickly.

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

Completeness2/5

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

Given the complexity of a git pull operation (mutation, potential for conflicts, multiple parameters) with no annotations, no output schema, and 0% schema description coverage, the description is incomplete. It misses behavioral details, parameter meanings, and output expectations, leaving the agent with insufficient context to use the tool safely and effectively.

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

Parameters2/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 but adds no parameter information. It doesn't explain what 'repo_path' expects (absolute vs. relative path, must be a git repo), what 'branch' does (defaults to current branch? pulls all branches?), or 'remote' behavior (what 'origin' means, can it be other remotes). With 3 parameters and no schema descriptions, this is inadequate.

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 verb ('pull') and resource ('changes from remote repository'), making the tool's function immediately understandable. It distinguishes itself from siblings like git_push (which pushes changes) and git_status (which shows status). However, it doesn't specify what type of changes (commits, tags, etc.) or mention merging behavior, keeping it from a perfect score.

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. It doesn't mention prerequisites (e.g., needing a git repository initialized, being in a clean state), when not to use it (e.g., during merge conflicts), or how it differs from similar tools like git_fetch (not in the sibling list but a common alternative).

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

Related 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/MementoRC/mcp-git'

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