Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

git_init

Initialize a new git repository in any directory to start tracking code changes and manage version control for your development projects.

Instructions

Initialize a new git repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoDirectory to initialize as git repository
bareNoCreate bare repository

Implementation Reference

  • The handler function that executes the 'git init' command, constructing the command with optional --bare flag and calling the shared executeGitCommand helper.
    export async function gitInit(args: z.infer<typeof gitInitSchema>): Promise<ToolResponse> {
      const bareFlag = args.bare ? '--bare' : '';
      return executeGitCommand(`git init ${bareFlag}`.trim(), args.cwd);
    }
  • Zod schema defining the input parameters for the gitInit handler: optional cwd and bare boolean.
    export const gitInitSchema = z.object({
      cwd: z.string().optional().describe('Directory to initialize as git repository'),
      bare: z.boolean().optional().default(false).describe('Create bare repository')
    });
  • MCP tool registration object within gitTools array, defining name, description, and JSON schema for 'git_init'.
    {
      name: 'git_init',
      description: 'Initialize a new git repository',
      inputSchema: {
        type: 'object',
        properties: {
          cwd: { type: 'string', description: 'Directory to initialize as git repository' },
          bare: { type: 'boolean', default: false, description: 'Create bare repository' }
        }
      }
    },
  • src/index.ts:397-400 (registration)
    Dispatch logic in main MCP server handler that matches tool name 'git_init', validates args with gitInitSchema, and calls gitInit function.
    if (name === 'git_init') {
      const validated = gitInitSchema.parse(args);
      return await gitInit(validated);
    }
  • Shared helper function used by all git tools, including gitInit, to execute git commands via child_process.exec and format ToolResponse.
    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 full burden but offers minimal behavioral insight. It states the action but doesn't disclose effects like creating a .git directory, requiring write permissions, or potential overwrite risks. This leaves significant gaps for a mutation tool.

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, direct sentence with zero wasted words. It's front-loaded with the core action and resource, making it highly efficient and easy to parse at a glance.

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 mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns, error conditions, or side effects like directory changes. Given the complexity and lack of structured data, more context is needed.

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 fully documents both parameters (cwd and bare). The description adds no parameter-specific information beyond what's in the schema, meeting the baseline for high coverage but not enhancing understanding.

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 ('Initialize') and the resource ('a new git repository'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like git_clone, but the verb 'initialize' is specific enough for basic distinction.

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 like git_clone for existing repositories. It lacks context about prerequisites (e.g., needing an empty directory) or typical use cases, offering only the basic function without situational advice.

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