Skip to main content
Glama

Git Worktree

git_worktree
Destructive

Manage Git worktrees by path or branch: add, list, remove, lock, unlock, prune, and repair plain worktrees, or create and clean up Git Flow worktrees addressed by branch name.

Instructions

Worktrees, two ways. Path-addressed (add, remove, lock, unlock, prune, repair) drives plain git worktree and needs nothing but git. Branch-addressed (flow_add, flow_remove, flow_list, flow_path) drives git flow worktree: it addresses worktrees by branch name, computes paths from the gitflow.worktreePath template, and tags provenance so cleanup can tell a git-flow-created worktree (removed) from a hand-made one (detached, work preserved). The flow_* actions require git-flow-next on PATH.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "git_worktree"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNo
forceNo
pathsNo
actionNolist
branchNo
expireNo
detachedNo
repo_pathNoAbsolute path to the local Git repository. If omitted, falls back to the server default set via the GIT_REPO_PATH environment variable or --repo-path CLI argument.
lock_reasonNo
response_formatNoOutput format for the response.markdown

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.2

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare destructive=true and readOnlyHint=false; the description adds that branch-addressed cleanup tags provenance and preserves work for hand-made worktrees by detaching rather than removing. It still does not explain force semantics, lock behavior, or failure handling.

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 compact sentences, front-loaded with the two-mode framing, and every clause carries substantive information about actions, addressing, provenance, or prerequisites. It avoids repetition despite the tool's complexity.

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?

For a destructive, 10-parameter tool with no output schema, the definition covers the main modes, prerequisites, and cleanup behavior. It is still incomplete on most parameter semantics and on how force or lock operations behave, so an agent must inspect the schema or experiment.

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 only 20%, and the description explains only the action groups and branch/path addressing at a high level. It leaves force, paths, expire, detached, and lock_reason without added meaning, so it does not compensate for the low coverage.

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

Purpose4/5

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

The description identifies the resource (worktrees) and enumerates the path- and branch-addressed actions, so the broad function is clear. It distinguishes the two internal modes but does not explicitly contrast with sibling tools such as git_flow or git_workspace.

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

Usage Guidelines4/5

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

It explains that path-addressed actions need only git while flow_* actions require git-flow-next on PATH, which gives practical selection context. It does not state explicit when-not-to-use cases or name alternative tools.

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