Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

git_fetch

Download objects and refs from remote Git repositories to update your local copy with changes from team members or upstream sources.

Instructions

Download objects and refs from remote repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoRepository directory
remoteNoRemote nameorigin
pruneNoRemove deleted remote branches

Implementation Reference

  • The main handler function that executes the git fetch command by calling the shared executeGitCommand helper with constructed git fetch arguments.
    export async function gitFetch(args: z.infer<typeof gitFetchSchema>): Promise<ToolResponse> {
      const pruneFlag = args.prune ? '--prune' : '';
      return executeGitCommand(`git fetch ${pruneFlag} ${args.remote}`.trim(), args.cwd);
    }
  • Zod schema used for input validation of the git_fetch tool parameters in the dispatcher.
    export const gitFetchSchema = z.object({
      cwd: z.string().optional().describe('Repository directory'),
      remote: z.string().optional().default('origin').describe('Remote name'),
      prune: z.boolean().optional().default(false).describe('Remove deleted remote branches')
    });
  • MCP protocol tool registration definition for git_fetch, including name, description, and JSON schema for tool listing.
    {
      name: 'git_fetch',
      description: 'Download objects and refs from remote repository',
      inputSchema: {
        type: 'object',
        properties: {
          cwd: { type: 'string', description: 'Repository directory' },
          remote: { type: 'string', default: 'origin', description: 'Remote name' },
          prune: { type: 'boolean', default: false, description: 'Remove deleted remote branches' }
        }
      }
    },
  • src/index.ts:409-411 (registration)
    Server request handler dispatcher that routes 'git_fetch' tool calls by parsing arguments with schema and invoking the gitFetch handler.
    if (name === 'git_fetch') {
      const validated = gitFetchSchema.parse(args);
      return await gitFetch(validated);
  • Core helper function that executes any git command via child_process.execAsync, handles errors, and returns standardized ToolResponse format used by all git tools including gitFetch.
    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
        };
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Download objects and refs' implies a read operation, it doesn't clarify whether this modifies local state, what happens on failure, whether authentication is needed, or what the typical output looks like. For a Git operation with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 that states the core purpose without unnecessary words. It's appropriately sized for a tool with good schema coverage and gets straight to the point with zero wasted text.

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?

For a Git operation with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what 'objects and refs' means practically, doesn't describe typical outputs or error conditions, and provides no context about how this fits into Git workflows. The combination of missing behavioral context and lack of output information creates significant gaps.

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

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents all three parameters (cwd, remote, prune). The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain parameter interactions, default behaviors, or practical usage examples. The baseline of 3 is appropriate when the schema does all the parameter documentation work.

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 action ('Download objects and refs') and target ('from remote repository'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling Git tools like git_pull or git_clone, which also interact with remote repositories.

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. With multiple Git siblings available (git_pull, git_clone, git_remote), there's no indication of when fetch is appropriate versus when other tools should be used, nor any mention of prerequisites or typical workflows.

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

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