# Gate API

> One answer to "is this ready to merge?", with every reason it is not yet. Every tool's arguments, answer, route and scope.

Source: https://bareci.com/docs/api/gate

One answer to "is this ready to merge?", with every reason it is not yet.

Each tool below is an MCP tool on `https://api.bareci.com/mcp` and, unless it is marked local, a route of the `https://api.bareci.com/v1` JSON API. The `bareci` CLI calls the same routes.

| Tool | What it does |
| --- | --- |
| [`ready`](#ready) | The Gate's verdict for a pull request, the same as the `BareCI: ready` check: ready, and every reason it is not yet, each with its module, whether it is pending or blocking, and the fix. |
| [`change_get`](#change_get) | Everything BareCI knows about a pull request: head, checks, preview, reviewers, verdict and recent events. |

## `ready`

**Is it ready to merge?.** The Gate's verdict for a pull request, the same as the `BareCI: ready` check: ready, and every reason it is not yet, each with its module, whether it is pending or blocking, and the fix.

- HTTP: `GET /v1/changes/{owner}/{name}/{pr}/ready`
- Scope: `read`
- Reads only

### Arguments

| Argument | Type | Required | Description |
| --- | --- | --- | --- |
| `repo` | string | yes | Repository as owner/name, e.g. acme/web |
| `pr` | integer | yes | Pull request number (min 1) |

### Answer

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ready` | boolean | no | True when every enabled module agrees |
| `sha` | string | no | Head |
| `reasons` | any[] | no | [{module, code, kind: pending or blocking, message, fix, url?}] |
| `counts` | object | no | Counts |

Every answer also carries `next`: the next action, usually a tool and its arguments.

### Example

```json
{
  "method": "tools/call",
  "params": {
    "name": "ready",
    "arguments": {
      "repo": "acme/web",
      "pr": 1
    }
  }
}
```

**Next:** the fix the first blocking reason names.

## `change_get`

**Pull request.** Everything BareCI knows about a pull request: head, checks, preview, reviewers, verdict and recent events.

- HTTP: `GET /v1/changes/{owner}/{name}/{pr}`
- Scope: `read`
- Reads only

### Arguments

| Argument | Type | Required | Description |
| --- | --- | --- | --- |
| `repo` | string | yes | Repository as owner/name, e.g. acme/web |
| `pr` | integer | yes | Pull request number (min 1) |

### Answer

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `headSha` | string | no | Head |
| `checks` | any[] | no | Check runs |
| `preview` | object or null | no |  |
| `verdict` | object or null | no |  |

Every answer also carries `next`: the next action, usually a tool and its arguments.

### Example

```json
{
  "method": "tools/call",
  "params": {
    "name": "change_get",
    "arguments": {
      "repo": "acme/web",
      "pr": 1
    }
  }
}
```

**Next:** ready.
