Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Restore App Revision

Use this to undo a change: it saves an earlier revision’s source as the app’s new current revision.

MCP name: restore_app_revision

Tool contract

{
  "annotations": {
    "destructiveHint": true,
    "openWorldHint": true,
    "readOnlyHint": false,
    "title": "Restore App Revision"
  },
  "description": "Use this to undo a change: it saves an earlier revision’s source as the app’s new current revision. History keeps every revision, including the one restored over, so a restore can itself be restored. Pass the `currentRevision` from list_app_revisions as expected_revision; a stale value is refused with `revision_mismatch`. A module-contract revision publishes at once. A package revision is rebuilt and answers with a build: poll get_app_build until it is `published`. Connector approvals the restored source does not declare are removed. Live app data does not change. Needs permission to change the app.",
  "execution": {
    "taskSupport": "forbidden"
  },
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "properties": {
      "app_id": {
        "description": "The app ID (UUID).",
        "type": "string"
      },
      "expected_revision": {
        "description": "The app’s current revision, from list_app_revisions `currentRevision`.",
        "maximum": 9007199254740991,
        "minimum": 0,
        "type": "integer"
      },
      "idempotency_key": {
        "description": "Repeating a package restore with the same key returns the same build.",
        "minLength": 1,
        "type": "string"
      },
      "revision": {
        "description": "The revision to restore, from list_app_revisions.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      }
    },
    "required": [
      "app_id",
      "revision",
      "expected_revision"
    ],
    "type": "object"
  },
  "name": "restore_app_revision",
  "outputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "additionalProperties": false,
    "properties": {
      "acceptedAt": {
        "type": "string"
      },
      "activeRevision": {
        "maximum": 9007199254740991,
        "minimum": 0,
        "type": "integer"
      },
      "appId": {
        "type": "string"
      },
      "attempts": {
        "maximum": 9007199254740991,
        "minimum": 0,
        "type": "integer"
      },
      "buildId": {
        "description": "Durable build ID. Use get_app_build to inspect progress or source.",
        "type": "string"
      },
      "deadline": {
        "type": "string"
      },
      "desiredRevision": {
        "maximum": 9007199254740991,
        "minimum": 0,
        "type": "integer"
      },
      "elapsedMs": {
        "minimum": 0,
        "type": "number"
      },
      "error": {
        "additionalProperties": false,
        "properties": {
          "column": {
            "description": "The 1-based column in `line`.",
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "details": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "execution": {
                    "enum": [
                      "not_started",
                      "may_have_run"
                    ],
                    "type": "string"
                  },
                  "operationId": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "reservationId": {
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "execution",
                  "operationId"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "properties": {
                  "execution": {
                    "const": "may_have_run",
                    "type": "string"
                  }
                },
                "required": [
                  "execution"
                ],
                "type": "object"
              }
            ]
          },
          "kind": {
            "type": "string"
          },
          "line": {
            "description": "The 1-based line in `path`.",
            "maximum": 9007199254740991,
            "minimum": -9007199254740991,
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "path": {
            "description": "The App file the failure points at, relative to the package root, when it points at one of the App's own files.",
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          },
          "specifier": {
            "type": "string"
          },
          "stage": {
            "description": "A stage only when the author's package caused the failure. `source`: the package was refused (its files, imports, or package.json, a size cap, a refused `connect-src` origin, a package name another App holds or that differs from the App's, or accepted source the current contract refuses); fix what the message names, in the file `path` names when given. `dependencies`: npm could not resolve or install the declared dependencies, or the tree has more packages than the limit; fix the package `specifier` names when given, its range in package.json, or trim the dependencies. `compile`: the compiler, or the check of the built server module, refused the App's code; fix the file and position named when given. Every other failure has no stage, because nothing in the package would fix it: a build sandbox, provider, executor, or database failing, a busy host, a cancellation, lost authority, an expired build or one that used up its attempts, an input Charming could not load, or a copy whose requested manifest id was taken. Save again.",
            "enum": [
              "source",
              "dependencies",
              "compile"
            ],
            "type": "string"
          },
          "target": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "message",
          "retryable"
        ],
        "type": "object"
      },
      "finishedAt": {
        "type": [
          "string",
          "null"
        ]
      },
      "idempotencyExpiresAt": {
        "type": [
          "string",
          "null"
        ]
      },
      "inputDigest": {
        "type": "string"
      },
      "inspectionExpiresAt": {
        "type": [
          "string",
          "null"
        ]
      },
      "intent": {
        "description": "The accepted operation: create, update, migrate, restore, or copy.",
        "type": "string"
      },
      "lockDigest": {
        "type": "string"
      },
      "lockState": {
        "enum": [
          "locked",
          "unresolved"
        ],
        "type": "string"
      },
      "manifestVersion": {
        "type": "string"
      },
      "ok": {
        "const": true,
        "type": "boolean"
      },
      "queueDeadline": {
        "type": "string"
      },
      "resolvedDependencies": {
        "additionalProperties": {
          "type": "string"
        },
        "description": "Exact package versions the build resolved for the declared dependencies.",
        "propertyNames": {
          "type": "string"
        },
        "type": "object"
      },
      "retryAfterSeconds": {
        "description": "Wait at least this many seconds before polling again.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      },
      "revision": {
        "description": "The new revision a module-contract restore published.",
        "maximum": 9007199254740991,
        "minimum": 0,
        "type": "integer"
      },
      "source": {
        "additionalProperties": false,
        "description": "Exact accepted source, returned only when include_source is true.",
        "properties": {
          "files": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "The accepted file tree: package.json, server.js, and any other files.",
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          }
        },
        "required": [
          "files"
        ],
        "type": "object"
      },
      "sourceEtag": {
        "description": "The quoted ETag of the revision this build saved once an App exists; an HTTP save passes it as If-Match. It doesn't change after a later save; get_app_source returns the current revision. Before a creation publishes, the digest of the accepted input.",
        "type": "string"
      },
      "sourceRevision": {
        "description": "The revision that was restored.",
        "exclusiveMinimum": 0,
        "maximum": 9007199254740991,
        "type": "integer"
      },
      "state": {
        "enum": [
          "queued",
          "resolving",
          "building",
          "validating",
          "published",
          "failed",
          "superseded",
          "canceled",
          "expired"
        ],
        "type": "string"
      },
      "statusUrl": {
        "description": "Authenticated HTTP status URL for this build.",
        "type": "string"
      },
      "updatedAt": {
        "type": "string"
      },
      "url": {
        "description": "App URL. Present only after successful publication.",
        "type": "string"
      }
    },
    "required": [
      "ok",
      "sourceRevision"
    ],
    "type": "object"
  }
}

Was this page helpful?