Skip to main content
Glama

pull

Pull changes from a specified remote repository branch using Git MCP Server. Ensure your local repository is updated by specifying the branch and remote name.

Instructions

Pull changes from remote

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
branchYesBranch name
pathNoPath to repository. MUST be an absolute path (e.g., /Users/username/projects/my-repo)
remoteNoRemote nameorigin

Implementation Reference

  • Core handler function that implements the 'pull' tool logic: validates repository and remote, executes 'git pull remote branch' command, handles caching and returns formatted output.
    static async pull({ path, remote = 'origin', branch }: PushPullOptions, context: GitToolContext): Promise<GitToolResult> { const resolvedPath = this.getPath({ path }); return await this.executeOperation( context.operation, resolvedPath, async () => { const { path: repoPath } = PathValidator.validateGitRepo(resolvedPath); await RepositoryValidator.validateRemoteConfig(repoPath, remote, context.operation); const result = await CommandExecutor.executeGitCommand( `pull ${remote} ${branch}`, context.operation, repoPath ); return { content: [{ type: 'text', text: `Changes pulled successfully\n${CommandExecutor.formatOutput(result)}` }] }; }, { command: 'pull', invalidateCache: true // Invalidate all caches } ); }
  • Registers the 'pull' tool with the MCP server, specifying its name, description, and input schema.
    { name: 'pull', description: 'Pull changes from remote', inputSchema: { type: 'object', properties: { path: { type: 'string', description: `Path to repository. ${PATH_DESCRIPTION}`, }, remote: { type: 'string', description: 'Remote name', default: 'origin', }, branch: { type: 'string', description: 'Branch name', }, }, required: ['branch'], }, },
  • Tool executor handler that validates input arguments using isPushPullOptions and delegates to GitOperations.pull.
    case 'pull': { const validArgs = this.validateArguments(operation, args, isPushPullOptions); return await GitOperations.pull(validArgs, context); }
  • Type definition for PushPullOptions used as input schema for 'pull' and 'push' tools.
    export interface PushPullOptions extends GitOptions, BasePathOptions { remote?: string; branch: string; force?: boolean; // Allow force push/pull noVerify?: boolean; // Skip pre-push/pre-pull hooks tags?: boolean; // Include tags }
  • Type guard function used to validate arguments for 'pull' tool.
    export function isPushPullOptions(obj: any): obj is PushPullOptions { return obj && validatePath(obj.path) && typeof obj.branch === 'string'; }

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/Sheshiyer/git-mcp-v2'

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