Inspect or clean up Codex worktrees
codex_worktreeList managed Codex worktrees, inspect git status and diffs inside them, or remove finished worktrees.
Instructions
List managed Codex worktrees (~/.codex-mcp/worktrees), inspect git status & diff inside a worktree, or remove a finished worktree.
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_worktree"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Optional repo path to filter worktrees when action="list". | |
| path | No | Worktree path (required for diff and remove). | |
| force | No | Allow removing a dirty worktree (action="remove"). | |
| action | Yes | ||
| max_bytes | No | Max diff size in bytes for action="diff". | |
| delete_branch | No | Also delete the codex/* branch after removing the worktree (action="remove"). |