Skip to main content
Glama

Create and switch to a new git branch

git_create_branch

Create a new Git branch from the current commit and switch to it, carrying uncommitted changes so you can isolate work without changing existing branch history.

Instructions

Create a new git branch from the current commit and switch to it.

Calls repo.create_head(branch_name) then branch.checkout(); uncommitted changes carry over onto the new branch, and live /config files now follow it.

Use when: starting an isolated set of changes without touching the current branch's commit history. Not for: switching to a branch that already exists — use git_checkout_branch. Returns: dict {"status": "created_and_checked_out", "branch": ...}. Errors: raises an exception from gitpython when a branch named branch_name already exists; raises RuntimeError (from _repo()) when no git repo exists.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "branch_name": "<branch_name>"
    },
    "name": "git_create_branch"
  }
}

Input Schema

NameRequiredDescriptionDefault
branch_nameYesName of the new git branch to create, e.g. 'automation-refactor'.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.0.1

TDQS

A4.5/5.0
Behavior4/5

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

Annotations only say this is a non-read-only, non-destructive, non-idempotent write, but the description discloses far more: uncommitted changes carry over, live /config files follow the new branch, the return shape, and both error modes (gitpython exception on name collision, RuntimeError from _repo() with no repo). This is behavior beyond what annotations provide.

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?

Front-loads the action and side effect, then uses labeled blocks (Use when / Not for / Returns / Errors) that each carry distinct information. The implementation note about create_head and checkout is the only borderline line, and it directly justifies the 'uncommitted changes carry over' claim.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

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

For a one-parameter mutation tool, everything needed to call it correctly is present: precondition checks, side effects, failure modes, and the return value. The Returns block is somewhat redundant with the output schema, but it does not leave any agent-relevant gap.

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 coverage is 100% and the branch_name parameter is already documented with an example, so the schema carries most of the load. The description adds one meaningful constraint beyond the schema: that creation fails if a branch of that name already exists, which defines the parameter's validity domain. That is a small but real increment over the baseline.

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?

States a specific verb and resource ('Create a new git branch') plus the crucial side effect ('switch to it'), so the agent knows this is create-and-checkout in one step. It is immediately distinguishable from git_checkout_branch, which is named as the tool it is not.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit 'Use when' clause gives the scenario (isolated set of changes without touching current commit history) and the 'Not for' clause names the alternative (git_checkout_branch) for the excluded case. Nothing about when to pick either tool is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools