Skip to main content
Glama

Git Checkout

git_checkout

Switch Git branches, checkout specific commits or tags, and restore files. Create tracked branches or force operations to manage repository state and working tree versions.

Instructions

Switch branches or restore working tree files. Can checkout an existing branch, create a new branch, or restore specific files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoPath to the Git repository. Defaults to session working directory set via git_set_working_dir..
targetYesBranch name, commit hash, or tag to checkout.
createBranchNoCreate a new branch with the specified name.
forceNoForce the operation, bypassing safety checks.
pathsNoSpecific file paths to checkout/restore (relative to repository root).
trackNoSet up tracking relationship with remote branch when creating new branch.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successYesIndicates if the operation was successful.
targetYesChecked out branch or commit.
branchCreatedYesTrue if a new branch was created.
filesModifiedYesFiles that were modified during checkout.
Behavior3/5

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

The description is consistent with the readOnlyHint:false annotation, using mutation verbs (switch, restore, create). It adds context about the three operational modes. However, it fails to disclose important behavioral traits like the risk of overwriting local changes during file restoration or the implications of detached HEAD state when checking out commits.

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?

Two sentences with zero waste. The first sentence establishes the dual nature of the tool (branches vs files), and the second enumerates the three specific modes. Information is front-loaded and every clause earns its place.

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?

Given the presence of a force parameter and the destructive potential of checkout operations, the description is minimally adequate but missing critical git-specific warnings. It should mention the risk of losing uncommitted changes or clarify HEAD detachment behavior, especially since annotations only indicate non-read-only status without detailing safety profiles.

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?

Despite 100% schema description coverage, the description adds value by mapping high-level use cases to specific parameters: 'existing branch' → target, 'create a new branch' → createBranch flag, and 'restore specific files' → paths parameter. This semantic bridging helps agents understand parameter purpose beyond type definitions.

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 uses specific verbs (switch, restore, create) and clearly identifies the resources (branches, working tree files). It distinguishes from siblings like git_branch by explicitly mentioning file restoration capabilities alongside branch operations, clarifying this tool's dual purpose.

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

Usage Guidelines3/5

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

The description enumerates three distinct usage modes (existing branch, new branch, file restoration), providing implicit context for when to use the tool. However, it lacks explicit guidance on when to use git_branch instead for branch creation, or when to avoid checkout due to uncommitted changes.

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

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