Skip to main content
Glama

codex_worktrees

Destructive

Manage isolated Git worktrees for Codex coding tasks: plan, create, inspect, hand off, and clean up without merging or pushing. Requires worktrees=true except for inspection.

Instructions

plan/create: repo or project_id, name, optional base; create also plan_id/key. inspect: project_id or path, offset/limit. handoff: finished task_id. cleanup: project_id, optional keep_branch, key. Except inspect, needs worktrees=true. Never merges/pushes.

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": {
      "action": "<action>"
    },
    "name": "codex_worktrees"
  }
}

Input Schema

NameRequiredDescriptionDefault
baseNoHEAD
nameNo
pathNo
repoNoAbsolute repository
limitNo
actionYes
offsetNo
plan_idNo
task_idNoTask id
project_idNo
request_idNoKey for identical retries
keep_branchNo
operation_idNoAlias of request_id

Output Schema

NameRequiredDescriptionDefault
okYes
result_versionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.3

TDQS

B3.1/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false and non-idempotent, so the safety profile is known. The description adds two genuinely useful facts the annotations cannot convey: the worktrees=true gate for four of five actions, and the boundary 'Never merges/pushes.' However, it does not say what cleanup destroys (e.g. branch deletion implied by keep_branch) or whether handoff mutates the task.

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?

Extremely compact and front-loaded by action, with no filler sentences. The telegraphic, colon-and-comma style trades some readability for density, but nearly every clause carries actionable routing information.

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?

Return values need not be explained because an output schema exists. Still, for a 13-parameter, five-action, destructive dispatcher, the definition leaves the effects of create, handoff and cleanup underspecified and never explains the worktrees=true prerequisite's origin or consequences of failure.

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

Parameters3/5

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

With schema coverage at 31% across 13 parameters, the description must carry the load, and it does map parameters to the action that consumes them (base optional on create, keep_branch on cleanup). But it introduces an undefined term 'key' for request_id/operation_id and never explains base, offset/limit behavior, or the 64-character plan_id constraint.

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 enumerates the five actions and their parameter needs but never states what a worktree operation actually does (plan a worktree, create a git worktree, hand off a finished task, remove a worktree). An agent can parse the action vocabulary but must infer the underlying resource and effect from the tool name alone.

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?

It routes between the five in-tool actions by required arguments (e.g. inspect takes project_id or path with offset/limit), and adds a real prerequisite: 'Except inspect, needs worktrees=true.' It offers no guidance on when to choose worktrees at all versus siblings such as codex_fork or codex_plans.

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