# rate_finding

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

The CodePanel MCP tool that rates a review finding, disputes a wrong one, or rates up to 50 at once: inputs, results and real responses.

`rate_finding` records whether a CodePanel review finding was right: `up` with `fixed` once you've pushed the fix, or `down` with a reason and a note when the finding is wrong, which disputes it. One call takes a single finding (`ref: "F3"`) or up to 50 (`ratings`). It needs the `reviews:write` scope.

## When to call it

- **After the push that fixes a finding:** `reason: "fixed"`. Given before the push, `fixed` holds the `CodePanel` status at pending until a newer commit arrives.
- **When a finding is wrong:** a down reason (`false_positive`, `wrong_location`, `not_worth_fixing` or `duplicate`) and a note that points at the `file:line`, test or document that shows it. If you don't understand the finding, ask with `ask_reviewer` before disputing.
- **When it's real but belongs elsewhere:** `reason: "deferred"`. It answers the finding without a dispute.
- **Once per round, for every finding you acted on or checked**, in one call with `ratings`, before you push again.

Which reason does what to the merge gate, and how a person's rating differs from an agent's, is in [Feedback](/docs/feedback#verdict-reasons).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `repo` | string | yes | Repository as owner/name |
| `pr` | integer | yes | Pull request number |
| `ref` | string | no | The finding as the review names it, e.g. "F3", or "review" for the whole review. Required unless ratings is given |
| `finding` | string | no | Alias for ref |
| `rating` | `up` or `down` | no | up or down. Leave it out when reason settles it: fixed, useful and deferred mean up; false_positive, wrong_location, not_worth_fixing, duplicate and unclear mean down |
| `reason` | string | no | One of fixed, useful, false_positive, wrong_location, not_worth_fixing, duplicate, deferred, unclear, other. fixed or useful for up; false_positive, wrong_location, not_worth_fixing, duplicate, unclear or other for down; deferred (real, handled outside this pull request) for either. Hyphens are fine |
| `note` | string, at most 1000 characters | no | Why, in a sentence: what you checked |
| `verdict` | string | no | Alias for reason; if both are given they must agree |
| `comment` | string, at most 1000 characters | no | Alias for note; if both are given they must agree |
| `ratings` | array of objects, at most 50 | no | Several ratings in one call, instead of ref and rating |
| `ratings[].ref` | string | no | The finding as the review names it, e.g. "F3", or "review" for the whole review |
| `ratings[].finding` | string | no | Alias for ref |
| `ratings[].rating` | `up` or `down` | no | up or down. Leave it out when reason settles it: fixed, useful and deferred mean up; false_positive, wrong_location, not_worth_fixing, duplicate and unclear mean down |
| `ratings[].reason` | string | no | One of fixed, useful, false_positive, wrong_location, not_worth_fixing, duplicate, deferred, unclear, other. fixed or useful for up; false_positive, wrong_location, not_worth_fixing, duplicate, unclear or other for down; deferred (real, handled outside this pull request) for either. Hyphens are fine |
| `ratings[].note` | string, at most 1000 characters | no | Why, in a sentence: what you checked |
| `ratings[].verdict` | string | no | Alias for reason; if both are given they must agree |
| `ratings[].comment` | string, at most 1000 characters | no | Alias for note; if both are given they must agree |
| `agent` | string | no | Your harness, e.g. claude-code (a Claude model id is read as claude-code and kept as the model). Defaults to this MCP client's name |

It writes: the server marks it `readOnlyHint: false` and `destructiveHint: true` (it can change what is already there), so a client that asks before writes asks here.

Pass either `ref` (with `rating`, `reason`, `note`) or `ratings`, not both. With `ratings`, every detail goes inside each item. Without either:

```text
CodePanel: ref is missing: name the finding, e.g. ref: "F3" (or pass ratings for several)
```

## What it returns

A single rating returns its `target`, the `rating` it recorded, and `outcome`: `created`, or `updated` when it replaced your earlier rating of the same finding. A rating that disputes the finding also returns `dispute.status`, `pending` at first.

With `ratings`, each item succeeds or fails on its own. The result lists them with `ok`, gives a failed one its `error` and `code`, and counts the failures in `failed`. The good items are recorded either way, so fix only the failed ones and send those again.

Ratings made through MCP are listed in the review comment's **Ratings** section with their notes, so on a public repository the note is public.

A rating alone does not always answer the gate. In the run below, F1 rated `up` with `useful` stayed in `gate.unanswered`, and `nextAction` still said `fix` for F1, because `useful` is a rating, not a verdict. Fix the finding or give it a verdict to stop it blocking.

## Examples

These responses come from a test account on a local backend.

### Dispute a wrong finding

```json title="Call"
{
  "repo": "codepanel-dev/web-app",
  "pr": 142,
  "ref": "F4",
  "reason": "false_positive",
  "note": "rateLimit.ts:63 sets the key with SET EX NX before INCR, so it always expires",
  "agent": "claude-code"
}
```

```json title="Result"
{ "target": "F4", "rating": "down", "outcome": "created", "dispute": { "status": "pending" } }
```

`rating` was left out: `false_positive` means down. The dispute then shows on the finding in `get_review`:

```json title="get_review, payload.disputes (trimmed)"
[
  {
    "ref": "F4",
    "status": "pending",
    "claim": "false_positive",
    "by": "api (claude-code)",
    "at": 1794613141708,
    "retryAt": 1794613321708,
    "countsAt": 1794613741708
  }
]
```

The orchestrator is asked at `retryAt`, 20 seconds after the first dispute on the pull request, and reads every pending dispute there in one call. If it hasn't ruled by `countsAt`, 4 minutes after the dispute, the dispute answers the gate anyway. To wait for it, call [`wait_for_review`](/docs/mcp-server/wait_for_review) with `disputes: true`. Don't dispute again or push to hurry it.

### Several findings in one call, one of them wrong

```json title="Call"
{
  "repo": "codepanel-dev/web-app",
  "pr": 142,
  "agent": "claude-code",
  "ratings": [
    { "ref": "F1", "reason": "useful", "note": "Real: the limiter trusts the client header" },
    { "ref": "F9", "reason": "fixed" }
  ]
}
```

```json title="Result"
{
  "results": [
    { "ref": "F1", "ok": true, "outcome": "created", "rating": "up", "target": "F1" },
    { "ref": "F9", "ok": false, "error": "Finding F9 not found on this pull request", "code": "not_found" }
  ],
  "failed": 1
}
```

### A token without `reviews:write`

```text
CodePanel: this token lacks the reviews:write scope
```

A token created under **Settings → API tokens** has only `read` unless you tick `reviews:write`, and an OAuth client that asks for no scope gets only `read` too. With a token, this comes back as a tool error. With an OAuth sign-in on the hosted server, the call answers `403` with an `insufficient_scope` challenge, so the client can reconnect and ask for the scope. Check a connection's scopes with `whoami`, and see [Scopes](/docs/mcp-server#scopes).

## The same step without MCP

| Surface | Form |
| --- | --- |
| Pull request comment | `/feedback F4 down false-positive rateLimit.ts:63 sets the key with EX NX --agent claude-code`, one line per finding ([syntax](/docs/commands#feedback)) |
| CLI | `codepanel feedback owner/name#123 F4 false-positive --note "..." --agent claude-code` ([CLI](/docs/cli)) |
| HTTP API | [`POST /feedback`](/docs/api#post-feedback) with the same fields |

A `rate_finding` call and a `/feedback --agent` line count the same for the merge gate. The one difference is `deferred`: from a person's account with write access, a `/feedback` reply closes the finding, while `rate_finding` only answers it.

## What the server tells your agent

The description your agent reads when it lists the tools:

> Say whether a review finding was right, so the reviewers improve. Rate every finding you acted on or checked: up when it was a real problem (reason fixed if you fixed it), down when it was wrong (reason false_positive, wrong_location, ...), with a one-sentence note saying why. rating can be left out when reason settles it (fixed means up, false_positive means down). Rate many at once with ratings (up to 50, like the lines of a /feedback comment); each item succeeds or fails on its own, and the result lists them with ok and, on failure, error and code. Use ref review to rate the whole review. A down rating with false_positive, wrong_location, not_worth_fixing or duplicate disputes the finding: the orchestrator checks your note against the code, usually within a few minutes or with the next round, and withdraws, upholds or revises it (see dispute in get_review); it stays open until withdrawn. Rating again replaces your earlier rating. The pull request stays blocked (get_review's gate) until every gated finding is fixed or answered: a verdict (fixed, deferred, or a down reason above) answers it, and a disputed one once the orchestrator withdraws or revises it (an upheld one needs fixed or deferred).

## Related

- [`wait_for_review`](/docs/mcp-server/wait_for_review): get the findings to rate, and wait on disputes.
- [Feedback](/docs/feedback): verdict reasons, disputes and what counts as answered.
- [Merge gate](/docs/merge-gate): which severities must be answered.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
