apply_setup
Execute a previously validated preview_setup planId after user confirmation (and browser-verified human approval for destructive or structural operations).
Overview
Loads the stored preview plan, verifies user ownership, expiration, payloadHash integrity, live RBAC, and human browser approval status if required.
Marks the plan consumed atomically so duplicate calls are idempotent and cannot replay destructive actions.
Permissions
- Required Scopes
- mcp:writeConditional: mcp:destructive (required when plan includes deletions or structural Discord setup); mcp:deploy (required when plan includes panel deployment)
- Discord Role Access
- Caller must still pass live RBAC for every operation at apply time.
- Server-Side Guard
- Plan owner match + live RBAC re-check + payloadHash verification + human browser approval verification when requiresHumanApproval=true
- Subscription Tier
- Enforces exact Free/Pro/Enterprise gates at execution time.
Input Schema
JSON Schema enforced by the server prior to RBAC and tier validation. Unknown properties are rejected strictly.
{
"type": "object",
"properties": {
"planId": {
"type": "string",
"minLength": 8,
"maxLength": 128,
"description": "Plan identifier returned by preview_setup."
},
"confirmed": {
"type": "boolean",
"description": "Explicit confirmation that the server manager approved applying the previewed plan."
},
"confirmationToken": {
"type": "string",
"minLength": 8,
"maxLength": 256,
"description": "Single-use confirmation token required for destructive or structural plans after browser approval."
}
},
"required": [
"planId",
"confirmed"
],
"additionalProperties": false
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| planId | string | Required | Plan identifier returned by preview_setup. |
| confirmed | boolean | Required | Explicit confirmation that the server manager approved applying the previewed plan. |
| confirmationToken | string | Optional | Single-use confirmation token required for destructive or structural plans after browser approval. |
Example
Apply an approved setup plan.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "apply_setup",
"arguments": {
"planId": "plan_01JEV4W9N8K2M3Q7R5T6Y8Z0AB",
"confirmed": true
}
}
}Response
Per-operation execution results and audit entry reference.
{
"planId": "plan_01JEV4W9N8K2M3Q7R5T6Y8Z0AB",
"guildId": "1200000000000000000",
"status": "applied",
"appliedCount": 2,
"results": [
{
"tool": "configure_ticket_system",
"module": "tickets",
"action": "update_settings",
"outcome": "applied"
},
{
"tool": "configure_greetings",
"module": "greeting",
"action": "update_settings",
"outcome": "applied"
}
],
"auditSequence": 412
}Errors
| Error Code | Condition | Resolution |
|---|---|---|
| UNAUTHORIZED | Missing, expired, or revoked Bearer access token or scoped Personal Access Token. | Re-authenticate through OAuth 2.1 or create a fresh token in https://mcp.taicket.xyz/account. |
| FORBIDDEN | Token lacks the required OAuth scope, the guild is outside allowedGuildIds, or caller lacks live Discord RBAC permissions. | Grant the required scope during consent or confirm your Discord server role permissions. |
| RATE_LIMITED | Caller exceeded the per-user sliding-window request limit. | Wait for the Retry-After window before issuing another request. |
| VALIDATION_ERROR | Input arguments failed Zod schema validation or contained invalid Discord snowflakes. | Inspect the parameter schema and supply valid Discord snowflake IDs and field types. |
| CROSS_GUILD_RESOURCE | A referenced channel, category, or role does not belong to the specified guildId. | Call get_server_topology for the target server and reference only resources returned for that guild. |
| HUMAN_APPROVAL_REQUIRED | Destructive deletion or structural Discord setup requires browser-verified human approval before execution. | Run with mode="preview" (or preview_setup), open the returned approvalUrl in a browser signed into Discord, approve the summary, then apply the plan with confirmationToken. |
| CONFIRMATION_REQUIRED | confirmed was false or missing, confirmationToken was invalid, or planId has expired past its 15-minute TTL. | Confirm the plan with the server manager or generate a fresh preview via preview_setup. |
| NOT_FOUND | The requested panel, item, command, or setup plan was not found for this server. | Inspect current resources with get_server_configuration and supply a valid ID. |
| CONFLICT | The resource already exists or the setup plan has already been consumed. | Use an update action or create a fresh preview plan before retrying. |
Behavior
- Re-verifies live Discord permissions and subscription tier at execution time to close TOCTOU windows.
- For requiresHumanApproval plans, rejects execution until a human completes Discord-authenticated approval at /oauth/approve-action matching approvedPayloadHash.
- Atomically marks the plan consumed and records every applied plan in the tamper-evident hash-chained audit log.
Related Tools