Docs

branch_action MCP tool

Project branches.

View as Markdown

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.

FieldTypeRequiredConstraintsDefaultDescription
actionenum("list", "create", "switch", "merge", "mergeToMain")yesaction for branch_action
resultStartintegernomin 0; max 90071992547409910First character offset to return. Use 0 for the first call.
resultEndintegernomin 1; max 90071992547409918000Exclusive 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.

FieldTypeRequiredConstraintsDefaultDescription
branchNamestringyesminLength 1; maxLength 80
sourceBranchstringnominLength 1
switchToBranchbooleannotrue

action=switch

Renderer tool: switchBranch.

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

FieldTypeRequiredConstraintsDefaultDescription
branchIdstringyesminLength 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.

FieldTypeRequiredConstraintsDefaultDescription
sourceBranchstringnominLength 1
targetBranchstringnominLength 1"main"
switchToTargetbooleannofalse

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.