# branch_action MCP tool

Project branches.

{/* Generated by landing/scripts/generate-mcp-docs.ts. Do not edit. */}

MCP name `branch_action` dispatches to renderer `branchAction`.

Does not use hosted quota. Local editor operation.

Project branches. action list shows branches and the current branch. action create makes a branch (branchName, optional sourceBranch, switchToBranch). action switch moves the editor (branchId). action merge merges sourceBranch into targetBranch (defaults to main). action mergeToMain merges the current feature branch into main. Merge actions require approval. Editor must be open. Does not use hosted quota. Local editor operation.

## Advertised MCP input

This tool is registered with **passthrough**. The fields below are what `listTools` advertises. The renderer still validates the child fields for the chosen action or kind. Extra advertised-only values are documented under Reachable behavior.

| Field | Type | Required | Constraints | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `action` | enum("list", "create", "switch", "merge", "mergeToMain") | yes | — | — | action for branch_action |
| `resultStart` | integer | no | min 0; max 9007199254740991 | 0 | First character offset to return. Use 0 for the first call. |
| `resultEnd` | integer | no | min 1; max 9007199254740991 | 8000 | Exclusive end offset. resultEnd - resultStart must be at most 8000. Increment resultStart by 8000 to page through large results. |

## Reachable behavior

Advertised action values match the renderer children: `list`, `create`, `switch`, `merge`, `mergeToMain`.

## Renderer child fields

These are the authoritative fields for each `action`. Send them on the same MCP call. Grouped MCP tools use passthrough, so these fields are not all listed in the advertised schema.

### `action=list`

Renderer tool: `listBranches`.

List project branches and identify the currently active branch. Use before creating, switching, or merging branches when branch names are unclear.

_No fields._

### `action=create`

Renderer tool: `createBranch`.

Create a project branch from the current branch or a specified source branch. By default this also switches the editor to the new branch.

| Field | Type | Required | Constraints | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `branchName` | string | yes | minLength 1; maxLength 80 | — | — |
| `sourceBranch` | string | no | minLength 1 | — | — |
| `switchToBranch` | boolean | no | — | true | — |

### `action=switch`

Renderer tool: `switchBranch`.

Switch the editor to an existing project branch. Use listBranches first if you do not know the branch ID.

| Field | Type | Required | Constraints | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `branchId` | string | yes | minLength 1 | — | — |

### `action=merge`

Renderer tool: `mergeBranch`.

Merge one project branch into another. Requires user approval before executing. Defaults to merging the current branch into main.

| Field | Type | Required | Constraints | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `sourceBranch` | string | no | minLength 1 | — | — |
| `targetBranch` | string | no | minLength 1 | "main" | — |
| `switchToTarget` | boolean | no | — | false | — |

### `action=mergeToMain`

Renderer tool: `mergeBranchToMain`.

Merge the current feature branch into the main branch so changes are persisted. Requires user approval before executing. Only works when on a feature branch (not main).

_No fields._

## Result window

Every local MCP tool accepts `resultStart` and `resultEnd` so large payloads can be paged.

- `resultStart` — first character offset. Default `0`.
- `resultEnd` — exclusive end offset. Default `8000`.
- `resultEnd - resultStart` must be at most **8000** characters.
- Increment `resultStart` by 8000 to read the next window.
