> ## Documentation Index
> Fetch the complete documentation index at: https://docs.macroscope.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP reference

> Protocol behavior, results, pagination, errors, limits and the personal settings tools of the Macroscope MCP server.

This page describes how the [MCP server](https://docs.macroscope.com/api-reference/mcp) behaves at the protocol level. To connect a client, see [Connect with OAuth](https://docs.macroscope.com/api-reference/mcp#connect-with-oauth). Each workspace tool takes the arguments and returns the fields of its endpoint; see [Tools](https://docs.macroscope.com/api-reference/mcp#tools).

## Protocol

The server uses the Streamable HTTP transport at the URL under [Connect with OAuth](https://docs.macroscope.com/api-reference/mcp#connect-with-oauth). It is tested with protocol versions 2025-03-26 through 2026-07-28.

Send one JSON-RPC message per HTTP `POST`:

* A JSON-RPC request the server accepts, such as `initialize`, `tools/list` or `tools/call`, gets one JSON-RPC response as a single `application/json` body, including a tool call that fails with a [tool error](#tool-errors). The server does not stream events.
* A supported notification the client sends, such as `notifications/initialized`, is accepted with HTTP `202` and no body. A `tools/call` sent without an `id` is rejected with `400`.
* A JSON-RPC response the client sends is accepted with HTTP `202` and no body.
* A batch of several messages in one body is rejected with `400`. `GET` is not supported.

Requests rejected at the HTTP level get the statuses under [HTTP errors](#http-errors). The server does not keep sessions or send notifications or requests to the client, and its tool list does not change while a client is connected. Requests a browser sends from another website's origin are rejected with `403`.

## Results

A successful call returns the endpoint's JSON response twice: as `structuredContent`, which matches the tool's output schema, and as the same JSON serialized in a single text content block for clients that read only text. The two are equivalent.

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "structuredContent": {
      "workspace": {
        "name": "workspaces/GITHUB_ORGANIZATION/12345678",
        "workspaceType": "GITHUB_ORGANIZATION",
        "workspaceId": "12345678",
        "displayName": "acme",
        "timezone": "America/Los_Angeles",
        "createdAt": "2024-01-02T03:04:05Z",
        "reportingSchedule": {
          "cadence": "REPORTING_CADENCE_WEEKLY",
          "boundaryWeekday": 5,
          "boundaryHour": 18
        }
      }
    },
    "content": [
      {
        "type": "text",
        "text": "{\"workspace\":{\"name\":\"workspaces/GITHUB_ORGANIZATION/12345678\",\"workspaceType\":\"GITHUB_ORGANIZATION\",\"workspaceId\":\"12345678\",\"displayName\":\"acme\",\"timezone\":\"America/Los_Angeles\",\"createdAt\":\"2024-01-02T03:04:05Z\",\"reportingSchedule\":{\"cadence\":\"REPORTING_CADENCE_WEEKLY\",\"boundaryWeekday\":5,\"boundaryHour\":18}}}"
      }
    ]
  }
}
```

## Pagination

Paginated tools return one page per call. Pass the result's `nextPageToken` as the `pageToken` argument of the next call, with the same other arguments except `pageSize`, which may change, until `nextPageToken` is absent. A short or empty page can still carry a token. Tokens are opaque: do not parse or construct them. Which tools are paginated, page size, token lifetime of up to 24 hours and consistency are the same as for the REST endpoints; see [Pagination](https://docs.macroscope.com/api#pagination).

## Errors

### Tool errors

A tool call that fails returns a result with `isError: true` and one text content block containing a JSON error:

```json theme={null}
{
  "error": {
    "code": "RESOURCE_EXHAUSTED",
    "message": "rate limited",
    "requestId": "6f1c2b9e-3d4a-4f5b-8c7d-2e1f0a9b8c7d",
    "retryAfterSeconds": 12
  }
}
```

`code` is a status code; the common ones are listed below. `message` describes the failure without data from outside the client's workspace. `requestId` identifies the request; include it in support requests. `retryAfterSeconds` is present only when a rate limit rejected the call.

| `code` | Meaning |
| - | - |
| `INVALID_ARGUMENT` | An argument does not match the tool's input schema, or a value, date range or page token is invalid. |
| `ABORTED` | The data changed while the call was handled, and nothing was changed: the repository settings or defaults changed since the version you passed, the workspace settings since the `etag` you passed, or the log export while `configure_log_export` was verifying its destination. Read the current state again, then retry if the change is still needed. |
| `FAILED_PRECONDITION` | The workspace or credential cannot satisfy the request, for example granting admin to someone outside the organization, or a log export destination that fails verification. |
| `PERMISSION_DENIED` | The key, or the signed-in person, lacks a permission the tool requires, a preference you named is not available in the workspace, or the personal settings tools are not available in the workspace. |
| `NOT_FOUND` | The data does not exist for the workspace, for example Approvability is not available. |
| `RESOURCE_EXHAUSTED` | A limit was reached. With `retryAfterSeconds`, the call was rate limited: wait that long before retrying. Without it, follow the operation's limits on its endpoint page: for example, [Configure log export](https://docs.macroscope.com/api-reference/endpoint/configure-log-export.md) allows 5 attempts per workspace per minute, so wait a minute. A result larger than 1 MiB also fails this way: narrow the request with a smaller `pageSize`, a shorter date range or narrower filters, because retrying unchanged fails again. |
| `DEADLINE_EXCEEDED` | The call ran past the 55-second timeout. Narrow the request before retrying. If the connection closes first, the client may receive no result at all. |
| `UNAVAILABLE` | The API is temporarily unavailable. Retry with backoff. |
| `INTERNAL` | Server error. Retry with backoff. |

These are the same failures the REST API reports with the HTTP statuses under [Errors](https://docs.macroscope.com/api#errors).

### HTTP errors

Some failures reject the HTTP request before any tool runs:

| HTTP | Meaning |
| - | - |
| `400` | A JSON-RPC batch, two different `Authorization` values, or a malformed body. |
| `401` | Missing, invalid, expired or revoked key or sign-in. Reconnect with a valid key, or sign in again. |
| `403` | The credential lacks access, the sign-in needs a higher scope, or the request supplied an untrusted origin. A scope challenge names the level the client can request; see [Permissions](https://docs.macroscope.com/api-reference/mcp#permissions). |
| `413` | The request body is too large. |
| `429` | The limit for requests that do not reach the API was reached. Wait `Retry-After` seconds. |
| `503` | API temporarily unavailable. |

## Limits

Tool calls share the REST API's per-key and per-workspace rate limits and 55-second timeout; see [Limits](https://docs.macroscope.com/api#limits). A tool call that reaches the API counts against those limits. Connecting, listing tools, and other requests rejected before they reach the API, such as an unknown tool or malformed arguments, use a separate limit for each key or signed-in person.

A signed-in person's tool calls count against a per-person limit in the workspace, the same size as a key's, shared by every client the person allows there, and against the workspace's limit, which they share with its API keys. Responses carry the `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` headers of the limit that applied.

## Account settings tools

`get_account_settings` and `update_account_settings` read and change your [Personal settings](https://docs.macroscope.com/settings.md#personal-settings). Only clients connected with OAuth can use them, and a change applies to your pull requests in every workspace. See [Personal settings](https://docs.macroscope.com/api-reference/mcp#account-settings) for who can use them.

### Fields

Both tools return `settings`, with your preferences in `values` and the names of the preferences you can read and change in `availableFields`, comma-separated. A preference is available when it is shown to you on the Personal settings page in the connected workspace: Check Run Agents and detection modes depend on the workspace's features, and Slack mentions on a Slack account connected in the workspace. A preference that is not available is omitted from `values` and cannot be changed.

Most preferences are overrides of a repository setting. An override is `true` for **Always on**, `false` for **Always off**, and omitted for **Repo default**, which follows each repository's setting.

| Field | Value | Omitted means |
| - | - | - |
| `correctnessReviewEnabled` | Whether [Correctness](https://docs.macroscope.com/correctness.md) reviews your pull requests | Repo default |
| `checkRunAgentsEnabled` | Whether [Check Run Agents](https://docs.macroscope.com/check-run-agents) run on your pull requests | Repo default |
| `detectionMode` | [Detection mode](https://docs.macroscope.com/code-review/detection-mode.md) for your pull requests: `DETECTION_MODE_BUDGET`, `DETECTION_MODE_BALANCED`, `DETECTION_MODE_PRECISE` or `DETECTION_MODE_ULTRA`. Only modes the workspace offers can be set. | Repo default |
| `commentSeverityThreshold` | [Minimum severity to comment](https://docs.macroscope.com/correctness.md#minimum-severity-to-comment) on your pull requests: `COMMENT_SEVERITY_THRESHOLD_OFF` (every finding), `_LOW`, `_MEDIUM`, `_HIGH` or `_CRITICAL` | Repo default |
| `draftPrReviewEnabled` | Whether Correctness reviews your draft pull requests | Repo default |
| `autoMergeFixPrsEnabled` | Whether [Fix it for me](https://docs.macroscope.com/fix-it-for-me.md) pull requests for your pull requests merge automatically when their checks pass | Repo default |
| `prSummaryEnabled` | Whether Macroscope [summarizes](https://docs.macroscope.com/pull-request-descriptions.md) your pull requests | Repo default |
| `prSummaryInDescription` | Whether summaries go in the pull request description, when it is empty or contains Macroscope's summary, instead of a comment | Not available |
| `costLimitCommentsEnabled` | Whether Macroscope comments on your pull request when a [cost limit](https://docs.macroscope.com/spend-limits.md) skips a review | Not available |
| `slackMentionsEnabled` | Whether Macroscope [Slack subscription](https://docs.macroscope.com/slack-subscriptions.md) messages can @mention you | Not available |

### Update account settings

`update_account_settings` changes only the preferences named in `updateMask`:

* `updateMask`: comma-separated names from the table, for example `"detectionMode,prSummaryEnabled"`. Between 1 and 10 names, each at most once.
* `settings`: a value for each named preference you set. To return an override to **Repo default**, name it and omit its value. `prSummaryInDescription`, `costLimitCommentsEnabled` and `slackMentionsEnabled` always need a value.

The update is all or nothing. A preference that is not in `availableFields`, or a detection mode the workspace does not offer, returns `PERMISSION_DENIED`. A name that is not a preference, a value without its name in `updateMask`, or a preference that always needs a value named without one returns `INVALID_ARGUMENT`. Either way, nothing changes. The result is your preferences after the update. Each change is recorded in the audit log of the connected workspace, with you and the connected app that made it.

This call sets your detection mode and returns your pull request summaries to the repository default:

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "update_account_settings",
    "arguments": {
      "updateMask": "detectionMode,prSummaryEnabled",
      "settings": { "detectionMode": "DETECTION_MODE_PRECISE" }
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.