Skip to main content
Glama

Switch config to an existing branch

git_checkout_branch
DestructiveIdempotent

Switch the Home Assistant config git repository to an existing branch, replacing tracked /config files with that branch's committed version. Use it to move between prepared branch configurations.

Instructions

Switch the HA config git repository to an existing branch.

Calls repo.git.checkout(branch_name), which replaces every tracked file under /config with that branch's committed version — the live configuration Home Assistant reads from changes as soon as this returns.

Use when: switching between prepared configurations that are tracked as branches. Not for: creating a branch that does not exist yet — use git_create_branch. Returns: dict {"status": "switched", "branch": ...}. Errors: raises an exception from gitpython when branch_name does not exist, or when uncommitted local changes would conflict with the target branch's files; raises RuntimeError (from _repo()) when no git repo exists. Limits: no confirm parameter; a conflicting uncommitted change blocks the checkout rather than being silently discarded (plain git behaviour), but a non-conflicting one carries over onto the new branch.

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_checkout_branch"
  }
}

Input Schema

NameRequiredDescriptionDefault
branch_nameYesName of an existing git branch to switch the config repository to.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.0.1

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true and idempotentHint=true, but the description goes well beyond them: it states that every tracked file under /config is replaced and that live HA configuration changes as soon as it returns. It also discloses exception types (gitpython errors, RuntimeError from _repo() when no repo exists) and the uncommitted-changes behavior — conflicting changes block, non-conflicting ones carry over — which is not encoded anywhere in structured fields.

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?

Front-loaded with the action and its effect, then cleanly sectioned into Use when / Not for / Returns / Errors / Limits. Every section adds information, though the Returns line partially duplicates the existing output schema and the prose wrapping is slightly denser than needed.

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 with an output schema, the definition covers effect scope, live-configuration impact, error modes, and the absence of a confirm parameter. Nothing an agent needs to invoke it safely is missing, including the fact that there is no confirmation gate.

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% and the single parameter is already documented, so the schema carries the baseline. The description adds meaning by tying branch_name to failure behavior (a nonexistent branch raises from gitpython) and to the concrete effect of the switch, which the schema does not convey.

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?

Opens with a specific verb and resource ("Switch the HA config git repository to an existing branch") and names the sibling it is not (git_create_branch), plus the underlying call repo.git.checkout(branch_name). An agent can distinguish it from git_create_branch and git_rollback_to_commit without opening any schema.

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: switching between prepared configurations that are tracked as branches" and "Not for: creating a branch that does not exist yet — use git_create_branch". Both the positive condition and the exclusion/alternative routing are stated outright.

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