# list_sessions

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

The CodePanel MCP tool that lists your recent review sessions, newest first, with each one's status and any failure reason.

`list_sessions` lists your recent review sessions, newest first, with each one's status and why it failed if it did. A session is one run of the panel on a pull request. It takes no required inputs and needs only the `read` scope.

## When to call it

- **To find a session id.** You need it for [`get_session`](/docs/mcp-server/get_session).
- **To see what is running now.** Pass `status: "active"`.
- **To see why a round failed.** Look for `status: "failed"` and read `error` and `errorCode`.
- **Not to wait for a review.** Use [`wait_for_review`](/docs/mcp-server/wait_for_review), which tracks one pull request's latest round for you.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `repo` | string | no | Repository as owner/name |
| `status` | `active` or `completed` or `all` | no |  |
| `limit` | integer, at most 100 | no |  |

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

`status` filters by state: `active` is a session still `initializing`, `reviewing`, `synthesizing` or `chatting`, `completed` is any other status, and `all` is the default. `limit` defaults to 20, and a value over 100 is treated as 100. Sessions come from your 500 most recent.

## What it returns

An array, newest first. Each item has:

| Field | Meaning |
| --- | --- |
| `id` | The session id |
| `status` | For example `reviewing`, `ready` or `failed` |
| `repo`, `prNumber`, `prTitle` | The pull request it reviewed |
| `activity` | A sentence on what the reviewers are doing now, while it runs, else `null` |
| `error`, `errorCode` | Why it failed, redacted, else `null` |
| `nextAction`, `publishError` | A refusal's next step, and why posting to GitHub failed, else `null` |
| `createdAt`, `completedAt` | Epoch milliseconds. `completedAt` is `null` while it runs |

## Examples

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

```json title="Call"
{
  "repo": "codepanel-dev/web-app",
  "limit": 3
}
```

```json title="Result"
[
  {
    "activity": "Three reviewers are still reading the change.",
    "completedAt": null,
    "createdAt": 1794614217488,
    "error": null,
    "errorCode": null,
    "id": "w979xqfpxr8fkr2pgwy3p8kq098j7psq",
    "nextAction": null,
    "prNumber": 145,
    "prTitle": "Migrate the checkout form to React Hook Form",
    "publishError": null,
    "repo": "codepanel-dev/web-app",
    "status": "reviewing"
  },
  {
    "activity": null,
    "completedAt": 1794603737488,
    "createdAt": 1794603657488,
    "error": null,
    "errorCode": null,
    "id": "w973va556fnc197xe48j92kz0n8j6r1n",
    "nextAction": null,
    "prNumber": 142,
    "prTitle": "Add rate limiting to the login endpoint",
    "publishError": null,
    "repo": "codepanel-dev/web-app",
    "status": "ready"
  },
  {
    "activity": null,
    "completedAt": 1794596533488,
    "createdAt": 1794596457488,
    "error": "Review timed out",
    "errorCode": null,
    "id": "w97a5f2d65k6sc65pvyx3mhcdn8j7dks",
    "nextAction": null,
    "prNumber": 137,
    "prTitle": "Upload avatars with presigned S3 URLs",
    "publishError": null,
    "repo": "codepanel-dev/web-app",
    "status": "failed"
  }
]
```

The first session is still running, so it has `activity` and no `completedAt`. The second finished as `ready`. The third failed with `error: "Review timed out"`.

## The same step without MCP

| Surface | Form |
| --- | --- |
| CLI | `codepanel sessions`, with `--repo`, `--status` and `--limit` ([CLI](/docs/cli)) |
| HTTP API | [`GET /sessions`](/docs/api#get-sessions) |

## What the server tells your agent

The description your agent reads when it lists the tools:

> Recent review sessions, newest first, with status and any failure reason.

## Related

- [`get_session`](/docs/mcp-server/get_session): one session with each reviewer's status.
- [`get_review`](/docs/mcp-server/get_review): the review a finished session produced.
- [`wait_for_review`](/docs/mcp-server/wait_for_review): wait for a round to finish.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
