# Merge branch

Tool: `veryfront__merge_branch`

Merge a branch into main or another branch, applying its file changes, deletions and the merge message to the target. Requires project.files.write.

## Arguments

| Name               | Type                  | Required | Description                                                                                                                                     |
| ------------------ | --------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `branch_id`        | string · uuid         | Yes      | Branch ID to merge                                                                                                                              |
| `expected_version` | integer · min 0       |          | Expected source branch version. Stale versions return a precondition failure before any merge writes.                                           |
| `target_branch_id` | string · uuid \| null |          | Target branch ID; omit for main. An unknown target returns not found. Merge eligibility and conflicts are checked again when the merge commits. |
| `merge_message`    | string                |          | Optional message describing the merge                                                                                                           |

## Responses

| Status | Description                                           |
| ------ | ----------------------------------------------------- |
| 200    | The tool ran; its output is result.structuredContent. |

## Call it

```bash
curl -X POST -N "https://api.veryfront.com/mcp" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Accept: application/json, text/event-stream" \
  -H "Content-Type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "veryfront__merge_branch",
    "arguments": {
      "branch_id": "00000000-0000-0000-0000-000000000000"
    }
  }
}'
```

## Example response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "{\"merged_documents\":0,\"added_documents\":0,\"deleted_documents\":0,\"auto_merged_documents\":0,\"audit_id\":\"string\",\"branch_name\":\"string\",\"target_branch_id\":\"string\",\"target_branch_name\":\"string\"}"
      }
    ],
    "structuredContent": {
      "merged_documents": 0,
      "added_documents": 0,
      "deleted_documents": 0,
      "auto_merged_documents": 0,
      "audit_id": "string",
      "branch_name": "string",
      "target_branch_id": "string",
      "target_branch_name": "string"
    }
  }
}
```
