# trigger_review

URL: https://codepanel.ai/docs/mcp-server/trigger_review

The CodePanel MCP tool that starts a review round on a pull request now. It spends your provider credits and counts as a round against the limit.

`trigger_review` starts a CodePanel review of a pull request now, instead of waiting for a push. It spends your provider keys or credits and counts as a round, so past the pull request's round limit it is refused. It needs `repo` and `pr`, and the `reviews:write` scope.

## When to call it

- **When `nextAction` is `trigger`.** No round has reviewed the head and nothing is running. This is also the one trigger that is allowed past the round limit: the round that confirms your own `fixed` or `deferred` on a critical finding.
- **When `wait_for_review` returns `no_review`.** Nothing started within 150 seconds of your push, so check that the repository is connected and auto-review is on, then trigger.
- **Not after every push.** A push starts its own round. Triggering on top of it spends a second round for nothing, and `trigger_review` is limited to 20 calls an hour per token.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `repo` | string | yes | Repository as owner/name |
| `pr` | integer | yes | Pull request number |
| `panelId` | string | no | Panel id, from get_panel |
| `traceparent` | string | no | Your W3C traceparent (00-<trace id>-<span id>-<flags>), if you trace your own work. Stored on the review and returned by get_review as traceparent, to join the review to your trace |
| `wait` | boolean | no | Wait for the new review to finish and return it, as wait_for_review does |
| `timeoutSeconds` | integer, at most 600 | no | Give up after this many seconds (default 600, max 600). On timeout the result says whether a review is running, and you call again. Each call ends within about 45 seconds whatever you pass, before the usual 60-second client limit (in Claude Code, when it sends a progress token, up to 8 minutes); if your client cancels tool calls sooner, pass a smaller value. |
| `detail` | boolean | no | With wait: Return the full review: the deprecated top-level findings copy, each finding's fingerprint, models and reviewers, the text of answered findings and held-back suggestions, payload.keys when every key worked, and payload.disputes. Leave it out to act on the review |

It writes: the server marks it `readOnlyHint: false`, so a client that asks before writes asks here.

Pass `wait: true` to trigger and wait in the same call. It does what [`wait_for_review`](/docs/mcp-server/wait_for_review) does for the new review, ignoring the review that was latest before the trigger, so an old finished round is not mistaken for the new one. If your client cancels calls after 60 seconds, each call still returns within about 45 seconds with `status: "timeout"`, and you continue with `wait_for_review`. In Claude Code, when it sends a progress token, a call can block for up to 8 minutes. `timeoutSeconds` only matters with `wait`. Waiting also needs the `read` scope.

`panelId` defaults to the repository's pinned panel, else your default. `traceparent` must be a valid W3C traceparent, or the call fails with a `400`. It is stored on the round this call starts and comes back from `get_review` as `traceparent`.

## What it returns

Without `wait`, the call returns once the round is scheduled, not when it ends:

| Field | Meaning |
| --- | --- |
| `scheduled` | Always `true` on success. The review runs in the background |
| `queued` | `true` when another run holds the pull request. This one starts when that ends, at the head as it is then |
| `queuedBehind` | What it waits for: `review` (a round, usually minutes) or `dispute` (the orchestrator answering disputes, usually under a minute). `null` when `queued` is `false` |
| `knownHeadSha` | The head CodePanel last saw from GitHub, or `null` before it has seen the pull request. A push it has not heard of may have moved it |
| `lastReviewedSha` | The commit the last completed review read, or `null` |

With `wait: true`, you get these fields together with the `wait_for_review` result for the new review (`status`, `review` and so on). The session id is not known when the call returns: the round creates it, and `get_review` or `list_sessions` shows it once it starts.

### When it refuses

- **Round limit.** Once the pull request has completed its limit of rounds, an agent's trigger is refused with `reason: "round_limit_reached"` and a `nextAction`, over HTTP as a `409`. Raise the limit with [`set_review_rounds`](/docs/mcp-server/set_review_rounds) only if your user asks for another paid round, or stop at green. The exception is the one confirming round for your own `fixed` or `deferred` on a critical. With no limit set, nothing is refused. The limits are in [Round limits](/docs/triggering-reviews#round-limits).
- **No GitHub access.** The call fails with `GitHub token not configured. Reconnect GitHub and try again.` when the account has no GitHub token.
- **No provider key.** With no panel that can run, the call fails with a precondition such as `provider_key_missing`, or `credits_required` on a deployment that sells credits.
- **Unknown repository.** A repository that is not connected, or not yours, reads as not found.
- **Rate limit.** More than 20 triggers an hour on one token returns a `429` with `retryAfter`.

## Examples

These responses come from a test account on a local backend. That backend has no GitHub token, so a successful trigger can't be shown here; the success result is the table above.

### A repository that is not connected

```json title="Call"
{
  "repo": "codepanel-dev/nope",
  "pr": 1
}
```

```text title="Result (error)"
CodePanel: Repository not found

If this message doesn't tell you how to fix the call, tell the CodePanel team with send_feedback_to_codepanel once you're done.
```

The last paragraph of that text is added to errors that don't say how to fix the call. See [`send_feedback_to_codepanel`](/docs/mcp-server/send_feedback_to_codepanel).

### What a caller sees when GitHub access is missing

```json title="Call"
{
  "repo": "codepanel-dev/api-server",
  "pr": 61
}
```

```text title="Result (error)"
CodePanel: GitHub token not configured. Reconnect GitHub and try again.
```

A real account with GitHub connected passes this check. The same text came back for a pull request with a round running (`web-app#145`).

## The same step without MCP

| Surface | Form |
| --- | --- |
| Pull request comment | `/review` on a line of its own, from a person with write access. Bots are refused with `write_permission_required` ([Commands](/docs/commands#review)) |
| CLI | `codepanel review owner/name#123 --trigger`, with `--wait` to wait for it ([CLI](/docs/cli)) |
| HTTP API | [`POST /reviews/trigger`](/docs/api#post-reviewstrigger) |
| Dashboard | **Start** on the **Pull requests** tab. A person's button always runs, whatever the limit |

## What the server tells your agent

The description your agent reads when it lists the tools:

> Start a review of a pull request now. Spends the user's provider credits, and counts as a round: past the pull request's round limit it is refused with reason round_limit_reached and a nextAction, except the one round that confirms your own fixed critical (get_review nextAction trigger). Returns queued (true when another run holds the pull request: this one starts when it ends, at the head as it is then; queuedBehind says whether that is a review round or a short dispute run), knownHeadSha (the head CodePanel last saw; a push it has not heard of yet may have moved it) and lastReviewedSha. Then call wait_for_review, or pass wait: true to block here until the new review finishes.

## Related

- [`wait_for_review`](/docs/mcp-server/wait_for_review): wait for the round this starts.
- [`get_review`](/docs/mcp-server/get_review): where `nextAction: "trigger"` comes from.
- [`set_review_rounds`](/docs/mcp-server/set_review_rounds): raise or end the round limit.
- [Round limits](/docs/triggering-reviews#round-limits): what counts as a round and what a trigger costs.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
