# get_run_diff

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

The CodePanel MCP tool that returns what an agent app run changed: its branch, commits, diffstat and patch.

`get_run_diff` returns what a run changed: its branch, base and head commits, files changed, insertions, deletions and the diffstat, and the patch on request. The branch is in your checkout either way; `get_run`'s `run.publish` says whether the runner pushed it and which pull request it opened.

## When to call it

- **To review a run's work** before you merge its branch.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `runId` | string | yes | Id of a run, from get_task's runs or start_task's task |
| `detail` | boolean | no | Add the patch |

It only reads: the server marks it `readOnlyHint: true`, so clients that ask before a write can run it without asking.

`runId`; `detail: true` adds the patch, cut at 200,000 characters.

## What it returns

`{ diff }`, `null` until the run has committed. `truncated` says when the patch was cut.

## The same step without MCP

| Surface | Form |
| --- | --- |
| HTTP API | `GET /tasks/runs/diff` with the `read` scope |
| CLI | `codepanel run diff <runId> [--detail]` |

## What the server tells your agent

The description your agent reads when it lists the tools:

> Use it once wait_for_run returns ended, to check the work before you merge or rerun it. What a run changed: its branch, base and head commits, files changed, insertions and deletions, and the diffstat. The branch stays in the owner's checkout (local runs never push). Compact by default; detail: true adds the patch, cut at 200,000 characters (truncated says so). diff is null until the run has committed.

## Related

- [`get_run`](/docs/mcp-server/get_run): the run with its diff summary.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
