Skip to main content
Glama

init

Initialize a new Git repository by specifying the path, initial branch, template, or creating a bare repository, enabling streamlined repository setup for AI-driven workflows.

Instructions

Initialize new Git repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bareNoCreate a bare repository (--bare)
initialBranchNoSet the initial branch name (--initial-branch)
repoPathYesAbsolute path where to initialize the git repository
templateNoTemplate directory to use (--template)

Implementation Reference

  • The private #handle method that executes the 'init' tool: initializes a Git repo at repoPath using simple-git with optional bare, initialBranch, template flags, returns success message and result.
    	readonly #handle: ToolCallback<typeof GIT_INIT_INPUT_SCHEMA> = async (input) => {
    		const sg = simpleGit(input.repoPath);
    
    		const options: string[] = [];
    
    		if (input.bare) {
    			options.push('--bare');
    		}
    
    		if (input.initialBranch) {
    			options.push('--initial-branch', input.initialBranch);
    		}
    
    		if (input.template) {
    			options.push('--template', input.template);
    		}
    
    		const result = await sg.init(options);
    
    		return {
    			content: [
    				{
    					type: 'text',
    					text: `Initialized ${input.bare ? 'bare ' : ''}Git repository in ${input.repoPath}`,
    				},
    				{
    					type: 'text',
    					text: JSON.stringify(result),
    				},
    			],
    		};
    	};
    }
  • Zod input schema for the 'init' tool defining required repoPath and optional bare, initialBranch, template parameters.
    export const GIT_INIT_INPUT_SCHEMA = {
    	repoPath: z.string().describe('Absolute path where to initialize the git repository'),
    	bare: z.boolean().optional().describe('Create a bare repository (--bare)'),
    	initialBranch: z.string().optional().describe('Set the initial branch name (--initial-branch)'),
    	template: z.string().optional().describe('Template directory to use (--template)'),
    };
  • Class method that registers the 'init' tool with the MCP server by calling srv.registerTool(name, config, handle).
    register(srv: McpServer) {
    	srv.registerTool(this.name, this.config, this.#handle);
    }
  • Site where GitInitTool is instantiated and its register method is called to add the 'init' tool to the server.
    new GitInitTool().register(server);
  • Getter returning the tool name as 'init'.
    get name() {
    	return 'init';
    }
Behavior3/5

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

Annotations indicate readOnlyHint=false, correctly aligning with the description's 'Initialize' action that creates something new. The description adds minimal behavioral context beyond annotations—it implies creation but doesn't detail what happens (e.g., creates .git directory, sets up initial structure) or mention side effects like overwriting existing repos. With annotations covering the mutation aspect, this is adequate but not rich.

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, clear 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.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 4 parameters, 100% schema coverage, and no output schema, the description is minimally complete. It states the action but lacks context on usage scenarios, prerequisites, or behavioral details like error cases. Given the structured data handles parameters well, the description is adequate but leaves gaps in practical guidance.

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%, with all parameters well-documented in the schema itself (e.g., 'bare' as 'Create a bare repository'). The description adds no additional parameter semantics beyond what's in the schema, so it meets the baseline for high coverage without compensating value.

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 verb ('Initialize') and resource ('new Git repository'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'create-branch' or explain how this foundational operation differs from other repository setup tools, which prevents a perfect score.

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. It doesn't mention prerequisites (like needing a directory path), when not to use it (e.g., on existing repositories), or how it relates to sibling tools like 'create-branch' for repository setup 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

Related 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/ver0-project/mcps'

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