Skip to main content
Glama
modelcontextprotocol

git MCP server

Official

git_create_branch

Create a new Git branch from a specified base branch to organize development work and manage code changes in a repository.

Instructions

Creates a new branch from an optional base branch

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes
branch_nameYes
base_branchNo

Implementation Reference

  • The core handler function implementing the git_create_branch tool logic using GitPython to create a new branch.
    def git_create_branch(repo: git.Repo, branch_name: str, base_branch: str | None = None) -> str:
        if base_branch:
            base = repo.references[base_branch]
        else:
            base = repo.active_branch
    
        repo.create_head(branch_name, base)
        return f"Created branch '{branch_name}' from '{base.name}'"
  • Pydantic BaseModel defining the input schema (parameters) for the git_create_branch tool.
    class GitCreateBranch(BaseModel):
        repo_path: str
        branch_name: str
        base_branch: str | None = None
  • MCP tool registration in the server's list_tools method, associating the name, description, and schema.
    Tool(
        name=GitTools.CREATE_BRANCH,
        description="Creates a new branch from an optional base branch",
        inputSchema=GitCreateBranch.model_json_schema(),
    ),
  • Enum value defining the tool name constant used in registration.
    CREATE_BRANCH = "git_create_branch"
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 'Creates' implies a mutation, it doesn't specify whether this requires write permissions, what happens if the branch already exists, or if there are side effects (e.g., affecting the working directory). The description lacks details on error conditions, success responses, or any behavioral traits beyond the basic action.

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 includes the key constraint ('optional base branch'), making it appropriately sized and easy to parse quickly.

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 (a mutation tool with 3 parameters), lack of annotations, 0% schema coverage, and no output schema, the description is incomplete. It doesn't explain parameter meanings, behavioral outcomes, error handling, or how it fits with sibling tools. For a tool that creates branches, more context is needed to ensure correct usage.

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

Parameters2/5

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

Schema description coverage is 0%, meaning parameters are undocumented in the schema. The description mentions 'optional base branch', which hints at the 'base_branch' parameter but doesn't explain its purpose or default behavior. It doesn't address 'repo_path' or 'branch_name' at all, leaving their semantics unclear. The description adds minimal value beyond the schema.

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 ('Creates a new branch') and resource ('from an optional base branch'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'git_branch' (which might list branches) or 'git_checkout' (which switches branches), leaving some ambiguity about when to use this specific creation tool versus others.

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 (e.g., needing an existing repository), compare it to sibling tools like 'git_branch' or 'git_checkout', or specify scenarios where this tool is appropriate versus not. Usage is implied but not explicitly stated.

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/modelcontextprotocol/git'

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