Skip to main content
Glama
martinsky999

MCP Git Server

by martinsky999

git_create_branch

Create a new Git branch from a specified base branch to organize development work and isolate 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 from a specified base branch or the current active branch.
    def git_create_branch(repo: git.Repo, branch_name: str, base_branch: str | None = None) -> str:
        if base_branch:
            base = repo.refs[base_branch]
        else:
            base = repo.active_branch
    
        repo.create_head(branch_name, base)
        return f"Created branch '{branch_name}' from '{base.name}'"
  • Pydantic model defining the input schema for the git_create_branch tool, including repo_path, branch_name, and optional base_branch.
    class GitCreateBranch(BaseModel):
        repo_path: str
        branch_name: str
        base_branch: str | None = None
  • Registration of the git_create_branch tool in the MCP server's list_tools method, specifying name, description, and input schema.
    Tool(
        name=GitTools.CREATE_BRANCH,
        description="Creates a new branch from an optional base branch",
        inputSchema=GitCreateBranch.schema(),
    ),
  • Enum definition providing the string name 'git_create_branch' used for tool registration.
    CREATE_BRANCH = "git_create_branch"
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 creation action but lacks details on permissions needed, error conditions (e.g., if branch exists), or side effects. This is inadequate for a mutation tool without annotation support.

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 is appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

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 mutation tool with no annotations, 0% schema coverage, and no output schema, the description is incomplete. It lacks crucial details like return values, error handling, and full parameter explanations, making it insufficient for effective use.

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%, so the description must compensate for undocumented parameters. It only mentions 'optional base branch', covering one of three parameters, and adds no meaning for 'repo_path' or 'branch_name'. This fails to address the coverage gap.

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'), making the purpose immediately understandable. However, it does not explicitly differentiate this tool from siblings like 'git_checkout' (which might also involve branch operations), missing full sibling 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. It mentions 'optional base branch' but does not specify scenarios (e.g., creating from HEAD vs. another branch) or prerequisites, leaving usage context vague.

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/martinsky999/mcp-git-py'

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