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

# Request a remediation review with MCP

> Preview one exact plan and ask a separate human to decide, without executing it.

An assistant can help prepare a supported remediation for human review. This workflow creates a **pending** run and approval request; it does not approve, execute, verify or roll back a change. Check the [live reference](https://docs.alignr.io/api-reference/live-schema.md) for availability on your deployment before relying on these tools.

## Prepare a user-owned key

For the full workflow, give a user-owned key `remediation:read` for the optional outline and run-status tools, `remediation:preview` for `get_remediation_review_preview`, and `remediation:request` for `request_remediation_review`. The active owner must hold `remediation.read` for the reads and preview, and both `remediation.read` and `remediation.execute` for request, with no required password change pending. The preview and request scopes also work on their exact-plan REST routes; they differ from the owner's permissions and grant no other REST write. A service key cannot use the preview or request tool. The server checks the key, owner and current permissions again when each call runs.

In **MCP → + Generate token**, select the three scopes for a user key. Tool discovery alone is not permission to call a tool; check the [live reference](https://docs.alignr.io/api-reference/live-schema.md) for the deployed contract.

## 1. Identify the exact plan

Start from an open detection and record its `detection_id` and the linked `plan_id`. `get_remediation_plan_outline` can explain broad plan intent under `remediation:read`, but its result is `metadata_only`: target and execution readiness are `not_checked`, simulation mode is unknown, and it **cannot** supply the review revision required below.

Ask the assistant to call `get_remediation_review_preview` with the two UUIDs:

```json theme={null}
{"detection_id":"11111111-1111-4111-8111-111111111111","plan_id":"22222222-2222-4222-8222-222222222222"}
```

The exact-plan preview checks the open detection, linked plan, selected target binding, current local authority and complete bounded step set (1–50 steps). Inspect `organizationId` and `organizationName`, every step's `actionType`, `integrationId`/`integrationName`, `resource` where required, `simulated`, `reversible` and `requiresApproval`. The response excludes credentials and executable step parameters. `reviewRequestReady: true` means these local request checks passed **at preview time**; `vendorExecutionReady: not_checked` does not promise a vendor action will succeed.

Save the returned `reviewRevision` and `revisionExpiresAt`. The revision lasts 15 minutes and is tied to the caller, exact detection, client, plan, step/target state and source state. The server checks live authority again on submission. Previewing does not create a run.

## 2. Request a named human's decision

After reviewing the exact target and scope, generate and record one new UUID for `idempotency_key`. Call `request_remediation_review` with the same detection and plan UUIDs and the preview's `reviewRevision`:

```json theme={null}
{"detection_id":"11111111-1111-4111-8111-111111111111","plan_id":"22222222-2222-4222-8222-222222222222","review_revision":"<reviewRevision from the current preview>","idempotency_key":"33333333-3333-4333-8333-333333333333"}
```

The server rechecks live permission, detection, plan, authority, target binding and source state before creating a pending run and pending approval. A changed or expired revision is refused; get a new preview and review the current target before making a **new** request. A successful result contains `runId`, `approvalId`, `runStatus: pending_approval`, `approvalStatus: pending` and `replayed: false`. A separate named human reviews the actual approval in **Activity → Approvals**; the requester cannot approve their own request. No step executes from this MCP call.

## 3. Resolve uncertainty and follow the result

If the response is lost or times out, do not create a fresh UUID and send another request. Retry **the same payload with the same `idempotency_key`** to recover the committed result; `replayed: true` identifies it. A different payload with the same key is refused. The existing result may be returned even after the preview revision expires, because the server looks up the original committed request first. If there is no committed request and the revision has expired or anything changed, inspect the current run/approval state, preview again, and use a new key only for a deliberately new request.

Use `get_remediation_run_status` or `list_remediation_runs` under `remediation:read` to follow the run. `pending_approval` is not execution; `completed` is not verified resolution. A named human may approve the request, but a changed target or plan can cause the queued execution to refuse to act. Check the run's separate verification status and fresh evidence before claiming a fix. Approval, execution and rollback remain in the signed-in [remediation workflow](https://docs.alignr.io/guides/remediation.md).

## When the call is refused

| Result | Next check |
| - | - |
| Unauthorised or forbidden | Confirm a live **user-owned** key, the exact MCP scope, current owner permissions and that no password change is required. A service key is refused. |
| Not found | Confirm the detection and plan UUIDs belong together in your MSP workspace. A foreign-workspace identifier is not disclosed. |
| Conflict | The detection may have closed, another run may be in flight, the target/authority may have changed, or the revision may have expired. Reopen the exact preview; do not reuse a changed payload under the same idempotency key. |
| Validation error | Check UUID syntax and the required `review_revision` value. |
| Timeout or server error | The outcome may be committed. Retry only the identical request under the recorded idempotency UUID, then inspect run and approval status. |

The [Developer Console](https://app.alignr.io/developer) **Try it** panel executes real REST requests in your workspace. It is not an isolated sandbox or an MCP tool runner. The corresponding REST preview and review-request routes are visible in the authenticated live schema when deployed; use the same exact-target and idempotency discipline there.

For the REST review request, enter the recorded UUID in **Idempotency-Key**. **Generate UUID** starts a new key; it is not a retry button. The console keeps the key after errors and shows conflicts without automatically resending the request.


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