# get_budget

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

The CodePanel MCP tool that reads your monthly budget and a repository's cap: own-key spend, holds, what is left and what the next round meets.

`get_budget` says how much of your monthly budget is spent and, given a repository, how much of that repository's cap, and what the next review round on it would meet. Call it before a push when you want to know whether a round will run, or after `wait_for_review` reports a refusal. It only reads, and it needs the `read` scope.

## When to call it

- **Before you push:** with `repo`, `repo.review` says whether the next round is open or refused, and which limit would refuse it.
- **After a refused round:** the `refusal` text is the one the review comment would carry. If a person has to act, pass it on.
- **Before `set_budget`:** read the current limits first, so you can undo your change.

Both limits count spend on your own provider keys only. Credits and the per-pull-request limit are not here ([Budgets and spending limits](/docs/budgets-and-limits)).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `repo` | string | no | Repository as owner/name |

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

Leave `repo` out for the account budget alone. With it, the answer adds the repository's cap and the `review` outlook.

## What it returns

- `month` (UTC, `YYYY-MM`) and `enforced`, always `true`.
- `account`: `limitUsd` (`null` for no budget), `source` (`default`, `custom` or `none`), `spentUsd` across every repository, `heldUsd` (estimates held by running rounds), `remainingUsd` and `status`.
- `repo`, with `repo`: the same counts for that repository, plus `capUsd` (`null` for no cap), and `review`: `status`, `remainingUsd`, `limitedBy` (`repo` or `account`) and the `refusal` the next round would get, or `null`.

`status` is `unlimited`, `open`, `reached`, or `uncountable` when the account has too many repositories or running rounds to count. A round is refused once recorded spend plus holds reaches the limit, so the last admitted round can overshoot by its own cost.

## Examples

These responses come from a test account on a local backend. The default budget, spend and repository are seed data.

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

```json title="Result"
{
  "account": {
    "heldUsd": 0,
    "limitUsd": 25,
    "remainingUsd": 23.250275,
    "source": "default",
    "spentUsd": 1.7497250000000002,
    "status": "open"
  },
  "enforced": true,
  "month": "2026-11",
  "repo": {
    "capUsd": null,
    "heldUsd": 0,
    "remainingUsd": null,
    "repo": "codepanel-dev/web-app",
    "review": {
      "limitedBy": "account",
      "refusal": null,
      "remainingUsd": 23.250275,
      "status": "open"
    },
    "spentUsd": 0.9393375000000003,
    "status": "unlimited"
  }
}
```

`source: "default"` means the account never chose a budget. The repository has no cap (`status: "unlimited"`), so the next round is limited by the account, with $23.25 left.

## The same step without MCP

| Surface | Form |
| --- | --- |
| CLI | `codepanel budget owner/name` ([CLI](/docs/cli)) |
| HTTP API | [`GET /budget?repo=owner/name`](/docs/api#get-budget) |

## What the server tells your agent

The description your agent reads when it lists the tools:

> The account's monthly budget (limitUsd, source default|custom|none) and, with repo, the repository's own cap (capUsd, null for none), each with this month's own-key spentUsd, heldUsd (running rounds) and remainingUsd, and status unlimited|open|reached|uncountable. repo.review says what the next round on it meets: status, remainingUsd, limitedBy (repo or account) and the refusal it would get.

## Related

- [`set_budget`](/docs/mcp-server/set_budget): change the account budget or a repository's cap.
- [`get_spend`](/docs/mcp-server/get_spend): where this month's money went.
- [`wait_for_review`](/docs/mcp-server/wait_for_review): reports a refused round.
- [Budgets and spending limits](/docs/budgets-and-limits#refusals): the refusal messages.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
