Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

git_pull

Fetch and integrate changes from remote Git repositories to keep local code synchronized with upstream developments.

Instructions

Fetch and integrate changes from remote repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoRepository directory
remoteNoRemote nameorigin
branchNoBranch to pull (defaults to current branch)
rebaseNoRebase instead of merge

Implementation Reference

  • The main handler function that constructs and executes the 'git pull' command using the shared executeGitCommand helper, handling optional parameters for remote, branch, rebase, and cwd.
    export async function gitPull(args: z.infer<typeof gitPullSchema>): Promise<ToolResponse> { const rebaseFlag = args.rebase ? '--rebase' : ''; const branch = args.branch || ''; return executeGitCommand(`git pull ${rebaseFlag} ${args.remote} ${branch}`.trim(), args.cwd); }
  • Zod schema defining the input parameters and validation for the git_pull tool.
    export const gitPullSchema = z.object({ cwd: z.string().optional().describe('Repository directory'), remote: z.string().optional().default('origin').describe('Remote name'), branch: z.string().optional().describe('Branch to pull (defaults to current branch)'), rebase: z.boolean().optional().default(false).describe('Rebase instead of merge') });
  • MCP tool definition/registration in the gitTools array exported from git.ts, including name, description, and inputSchema for tool listing.
    { name: 'git_pull', description: 'Fetch and integrate changes from remote repository', inputSchema: { type: 'object', properties: { cwd: { type: 'string', description: 'Repository directory' }, remote: { type: 'string', default: 'origin', description: 'Remote name' }, branch: { type: 'string', description: 'Branch to pull (defaults to current branch)' }, rebase: { type: 'boolean', default: false, description: 'Rebase instead of merge' } } } },
  • src/index.ts:385-388 (registration)
    Runtime dispatch/registration in the main MCP server handler that routes 'git_pull' calls to the gitPull function after schema validation.
    if (name === 'git_pull') { const validated = gitPullSchema.parse(args); return await gitPull(validated); }
  • Shared utility function that executes git commands via child_process.exec, handles errors, and formats standardized ToolResponse for all git tools including git_pull.
    async function executeGitCommand(command: string, cwd?: string): Promise<ToolResponse> { try { const { stdout, stderr } = await execAsync(command, { cwd: cwd || process.cwd(), shell: '/bin/bash', maxBuffer: 10 * 1024 * 1024 // 10MB buffer }); return { content: [ { type: "text" as const, text: JSON.stringify({ success: true, command: command, stdout: stdout.trim(), stderr: stderr.trim(), cwd: cwd || process.cwd() }, null, 2) } ] }; } catch (error: any) { return { content: [ { type: "text" as const, text: JSON.stringify({ success: false, command: command, stdout: error.stdout?.trim() || '', stderr: error.stderr?.trim() || error.message, exitCode: error.code || 1, cwd: cwd || process.cwd() }, null, 2) } ], isError: true }; } }

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/ConnorBoetig-dev/mcp2'

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