Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

git_clone

Clone a Git repository into a specified directory with options for branch selection, shallow cloning, and custom destination paths.

Instructions

Clone a repository into a new directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesRepository URL to clone
destinationNoDestination directory (defaults to repo name)
cwdNoDirectory to clone into
branchNoSpecific branch to clone
depthNoCreate shallow clone with depth

Implementation Reference

  • The gitClone function implements the core logic for the git_clone tool by constructing and executing a 'git clone' command with optional parameters using the shared executeGitCommand helper.
    export async function gitClone(args: z.infer<typeof gitCloneSchema>): Promise<ToolResponse> {
      const branchFlag = args.branch ? `-b ${args.branch}` : '';
      const depthFlag = args.depth ? `--depth ${args.depth}` : '';
      const destination = args.destination || '';
      return executeGitCommand(`git clone ${branchFlag} ${depthFlag} ${args.url} ${destination}`.trim(), args.cwd);
    }
  • Zod schema defining the input validation for the git_clone tool parameters.
    export const gitCloneSchema = z.object({
      url: z.string().describe('Repository URL to clone'),
      destination: z.string().optional().describe('Destination directory (defaults to repo name)'),
      cwd: z.string().optional().describe('Directory to clone into'),
      branch: z.string().optional().describe('Specific branch to clone'),
      depth: z.number().optional().describe('Create shallow clone with depth')
    });
  • src/index.ts:393-396 (registration)
    Registration in the main MCP server request handler that dispatches 'git_clone' tool calls to the gitClone function after validating arguments with gitCloneSchema.
    if (name === 'git_clone') {
      const validated = gitCloneSchema.parse(args);
      return await gitClone(validated);
    }
  • MCP tool definition in the gitTools array, providing the tool name, description, and JSON inputSchema for listing in MCP tool discovery.
    {
      name: 'git_clone',
      description: 'Clone a repository into a new directory',
      inputSchema: {
        type: 'object',
        properties: {
          url: { type: 'string', description: 'Repository URL to clone' },
          destination: { type: 'string', description: 'Destination directory (defaults to repo name)' },
          cwd: { type: 'string', description: 'Directory to clone into' },
          branch: { type: 'string', description: 'Specific branch to clone' },
          depth: { type: 'number', description: 'Create shallow clone with depth' }
        },
        required: ['url']
      }
    },
  • Shared helper function used by all git tools, including gitClone, to execute git commands and format responses.
    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?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('clone') but doesn't mention side effects (e.g., creating files/directories, network usage), authentication needs (e.g., for private repos), error handling, or performance implications. This is a significant gap for a tool with potential side effects.

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 waste. It's front-loaded with the core action and outcome, making it easy to parse quickly. Every word earns its place.

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 clone operation (with side effects, network dependencies, and no output schema), the description is insufficient. It doesn't cover behavioral aspects, error cases, or output expectations, leaving the agent with incomplete context for safe and effective use.

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 documents all parameters thoroughly. The description doesn't add any parameter-specific details beyond what's in the schema (e.g., it doesn't explain URL formats or directory interactions). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('clone') and resource ('repository'), and it distinguishes from sibling tools like git_init (which creates a new repo) or git_pull (which updates an existing clone). The phrase 'into a new directory' further clarifies the outcome.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention when to prefer git_clone over git_init for starting work, or how it relates to git_pull for updates. The description lacks context about prerequisites or typical use cases.

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