Skip to main content
Glama

Apply a plan

apply_plan
Destructive

Writes a reviewed sync plan to a target Shopify store, creating or updating only changed items while skipping anything modified since planning. Supports audit logging and background runs for large plans.

Instructions

Write a reviewed plan to the target store. Refused unless the target has allowWrites=true. For a protected store the person is asked to confirm in the client (or applies from the command line); the assistant can't confirm on their behalf. Re-reads the target first and skips anything that changed since planning. Uploads missing files. Creates and updates only, never deletes. Every op is written to the audit log (get_audit_log). Returns { plan_id, status, totals (created, updated, skipped, failed), results per op }; a plan of more than 50 steps runs in the background instead and returns at once: follow it with apply_status and stop it with cancel_apply. A plan can be applied once, within an hour of plan_sync.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "plan_id": "<plan_id>"
    },
    "name": "apply_plan"
  }
}

Input Schema

NameRequiredDescriptionDefault
onlyNoApply only these ops, by their seq number in the plan (e.g. [1, 2, 3]). Default: every op.
waitNoWait for the whole apply before returning. By default a plan of more than 50 steps (SYNC_BACKGROUND_STEPS) runs in the background and this returns at once; follow it with apply_status.
confirmNoLeave empty. Only read when the server runs with SYNC_ALLOW_AGENT_CONFIRM=true (unattended automation); otherwise a protected store is confirmed by the person, not by this argument.
plan_idYesThe plan to write, from plan_sync. It must not have been applied yet and must be less than an hour old.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.11.6
    • changedInput schema / properties / only / description
      Previous value: -"Apply only these op seq numbers."New value: +"Apply only these ops, by their seq number in the plan (e.g. [1, 2, 3]). Default: every op."
    • addedInput schema / properties / plan_id / description
      Added value: +"The plan to write, from plan_sync. It must not have been applied yet and must be less than an hour old."
  2. Changed2 schema fields changedv0.11.4
    • changedInput schema / properties / confirm / description
      Previous value: -"Target's myshopify domain; required for protected stores."New value: +"Leave empty. Only read when the server runs with SYNC_ALLOW_AGENT_CONFIRM=true (unattended automation); otherwise a protected store is confirmed by the person, not by this argument."
    • addedInput schema / properties / wait
      Added value: +{
      +  "description": "Wait for the whole apply before returning. By default a plan of more than 50 steps (SYNC_BACKGROUND_STEPS) runs in the background and this returns at once; follow it with apply_status.",
      +  "type": "boolean"
      +}
  3. First observedv0.1.0

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Very rich beyond the annotations: refusal conditions, interactive confirmation routed to the person, re-read-and-skip-changed semantics, no deletes, audit logging, a 50-step background threshold, and the return shape. The caveat is a mild tension with destructiveHint=true, since 'creates and updates only, never deletes' understates that in-place updates overwrite existing content; it is a refinement rather than a flat contradiction, but it slightly softens the annotation's warning.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Dense and front-loaded with the write/refusal condition first, then guarantees, then return behavior, then follow-ups. It is one long paragraph with several parenthetical asides, which is slightly crammed, but no sentence is filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, yet the description spells out the returned object (plan_id, status, totals, per-op results) and the background-mode divergence including how to follow and cancel. For a stateful, refusable, non-idempotent write tool this covers everything needed to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents plan_id freshness, the wait/background threshold, the confirm gate, and the only/seq filter. The description reinforces plan_id age and the 50-step threshold but adds no syntax or semantics the schema lacks, and never mentions the 'only' op-selection parameter. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource ('Write a reviewed plan to the target store') and implicitly separates itself from plan_sync (creates the plan) and apply_status/cancel_apply (manage a running apply). An agent can tell exactly what this does without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit routing and preconditions: requires allowWrites=true, requires a plan from plan_sync under an hour old and not yet applied, applies once only, and names the follow-up tools for the background case (apply_status) and abort (cancel_apply). It also states the assistant cannot confirm for a protected store, which sets a hard usage boundary.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.