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
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"branch": "<branch>"
},
"name": "pull"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| branch | Yes | Branch name | |
| path | No | Path to repository. MUST be an absolute path (e.g., /Users/username/projects/my-repo) | |
| remote | No | Remote name | origin |
Implementation Reference
- src/git-operations.ts:344-371 (handler)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 } ); } - src/tool-handler.ts:194-216 (registration)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'], }, }, - src/tool-handler.ts:598-601 (handler)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); } - src/types.ts:66-72 (schema)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 } - src/types.ts:164-168 (helper)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'; }