Skip to main content
Glama
jesspig

git-mcp-server

by jesspig

git_checkout

Destructive

Switch between git branches, tags, or commits, or create a new branch and switch to it. Preview impact before discarding local changes.

Instructions

Switch to an existing branch, tag, or commit, optionally creating a branch first. Use this to move between branches for different features, to jump to a tag or historical commit, or to start a new branch with create_branch. Does NOT discard local changes without confirmation: force=True discards them and requires confirmed=True — run preview=True first to see what would be discarded, or git_stash to keep changes. Best for: moving between branches to work on different features. Returns: 'Switched to branch ' on success, or an impact preview when preview=True; use git_branch to list what is available to switch to.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNoForce checkout: discard local changes, or replace an existing branch when create_branch is set
targetNoBranch or commit to switch to
previewNoPreview the checkout impact (target and files that would be discarded) without executing
confirmedNoExplicit confirmation required when force is True
repo_pathNoPath to the git repository, defaults to '.' (the server working directory).
create_branchNoCreate and switch to a new branch
Behavior5/5

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

The description discloses critical behaviors beyond the destructiveHint annotation: local changes are not discarded without confirmation, force=True requires confirmed=True, and preview=True shows what would be discarded. This contextualizes the destructive nature and prevents accidental data loss.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear labels ('Best for:', 'Returns:') and is front-loaded. However, it repeats 'moving between branches' twice, making it slightly less concise than ideal. Still, every section earns its place.

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?

This is a complex tool (branch/tag/commit, force, preview, create) with no output schema. The description fully covers return values ('Switched to branch <name>', impact preview), handling of local changes, and related tools (git_branch, git_stash). It is complete enough for an agent to select and use safely.

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

Parameters4/5

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

Schema coverage is 100% with each parameter already described, so baseline is 3. The description adds meaningful semantic guidance for force/confirmed/preview relationships and mentions create_branch, which goes beyond the schema. Slight redundancy with target being branch/commit while description includes tags, but overall adds value.

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?

The description opens with a specific verb and resource: 'Switch to an existing branch, tag, or commit, optionally creating a branch first.' This clearly distinguishes git_checkout from sibling tools like git_branch (which lists branches) and git_stash (which saves changes).

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?

Provides explicit usage context: 'Use this to move between branches for different features, to jump to a tag or historical commit, or to start a new branch with create_branch.' It also names alternatives and complementary tools: git_stash for keeping changes and git_branch for listing available targets.

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/jesspig/git-mcp-server'

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