Skip to main content
Glama
martinsky999

MCP Git Server

by martinsky999

git_checkout

Switch between branches in a Git repository to access different code versions or development lines.

Instructions

Switches branches

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes
branch_nameYes

Implementation Reference

  • The main handler function that performs the git checkout operation on the given repository and branch.
    def git_checkout(repo: git.Repo, branch_name: str) -> str:
        repo.git.checkout(branch_name)
        return f"Switched to branch '{branch_name}'"
  • Pydantic model defining the input schema for the git_checkout tool, including repo_path and branch_name.
    class GitCheckout(BaseModel):
        repo_path: str
        branch_name: str
  • Registration of the git_checkout tool in the list_tools handler, using the name from GitTools.CHECKOUT and GitCheckout schema.
    Tool(
        name=GitTools.CHECKOUT,
        description="Switches branches",
        inputSchema=GitCheckout.schema(),
    ),
  • Enum value in GitTools defining the tool name 'git_checkout'.
    CHECKOUT = "git_checkout"

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.6/5.0
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. 'Switches branches' implies a mutation operation, but it doesn't disclose critical traits like whether it requires a clean working directory, what happens to uncommitted changes, or if it can create new branches. This leaves significant gaps in understanding the tool's behavior and risks.

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 extremely concise with just two words, front-loaded and zero waste. Every word earns its place, making it efficient for quick scanning, though this brevity contributes to gaps in other dimensions.

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 tool's complexity (mutation operation with 2 parameters), no annotations, no output schema, and 0% schema description coverage, the description is incomplete. It lacks details on behavior, parameters, and output, failing to provide enough context for safe and 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 adds no meaning beyond the schema—it doesn't explain what 'branch_name' and 'repo_path' represent, their formats, or constraints. For a tool with 2 parameters and no schema descriptions, this is inadequate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Switches branches' states a clear verb ('switches') and resource ('branches'), but it's vague about scope and doesn't differentiate from siblings like git_create_branch or git_reset. It doesn't specify if this only switches existing branches or can create new ones, leaving the purpose somewhat ambiguous.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing branch), exclusions (e.g., not for creating branches), or compare to siblings like git_create_branch for branch creation or git_reset for undoing changes. 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.