# Save reviewed application form draft

`deal_application_editor.replace`

Replace the complete draft using the exact config and state tokens from validate_config. Preserve question identities; omitted questions are removals. Save the validated draft directly without requesting approval. Unsupported conversions remain blocked. This stages changes only and does not change submitted answers or notify participants. Publishing requires its own publication review and consent, including notifications. For stale state, read and validate again; for an uncertain outcome retry identical arguments with the same client_request_id. Use review_undo or review_reset to recover draft changes. This toolset requires a specific grant and is not assigned by default; request access through Support.

[Deal application editor guide](https://docs.staging.levr.ai/mcp/resources/deal_application_editor.md)

Availability depends on live discovery and your access to the record. Do not infer MCP calls from REST paths.

Operation: write. Required OAuth scopes: mcp.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "allow_destructive_changes": {
      "default": false,
      "description": "Legacy compatibility field. Draft saves do not delete stored answers; publishing requires its own destructive opt-in and approval.",
      "type": "boolean"
    },
    "client_request_id": {
      "description": "Unique request identity. Retry an uncertain result with identical arguments and the same key.",
      "maxLength": 255,
      "minLength": 1,
      "pattern": "\\S",
      "type": "string"
    },
    "config": {
      "additionalProperties": false,
      "properties": {
        "application_runtime_structure": {
          "description": "Complete editable structure for the selected application runtime.",
          "type": "object"
        },
        "config_type": {
          "const": "application_runtime_structure",
          "description": "Document kind used to distinguish this config from other portable documents."
        },
        "config_version": {
          "const": 1,
          "description": "Version of the portable Runtime Editor config contract."
        }
      },
      "required": [
        "config_version",
        "config_type",
        "application_runtime_structure"
      ],
      "type": "object"
    },
    "deal_id": {
      "description": "Exact Deal id from deals.list or deals.get in the selected provider workspace; do not pass an application or runtime ID.",
      "maxLength": 32,
      "minLength": 1,
      "pattern": "^deal_[a-z0-9]+$",
      "type": "string"
    },
    "expected_draft_revision": {
      "description": "Copy draft_revision from the same current action review.",
      "pattern": "^[0-9a-f]{64}$",
      "type": "string"
    },
    "expected_live_revision": {
      "description": "Copy live_revision from the current action review.",
      "pattern": "^[0-9a-f]{64}$",
      "type": "string"
    },
    "provider_slug": {
      "description": "Provider workspace returned by providers.list.",
      "maxLength": 255,
      "minLength": 1,
      "type": "string"
    },
    "review_digest": {
      "description": "Copy review_digest from validate_config for this exact config.",
      "pattern": "^[0-9a-f]{64}$",
      "type": "string"
    },
    "user_confirmed": {
      "description": "Legacy compatibility field; draft saves do not require confirmation.",
      "type": "boolean"
    }
  },
  "required": [
    "provider_slug",
    "deal_id",
    "config",
    "expected_live_revision",
    "expected_draft_revision",
    "review_digest",
    "client_request_id"
  ],
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "oneOf": [
    {
      "not": {
        "required": [
          "error"
        ]
      },
      "properties": {
        "ok": {
          "const": true
        }
      },
      "required": [
        "data"
      ]
    },
    {
      "not": {
        "required": [
          "data"
        ]
      },
      "properties": {
        "ok": {
          "const": false
        }
      },
      "required": [
        "error"
      ]
    }
  ],
  "properties": {
    "data": {
      "additionalProperties": false,
      "properties": {
        "attachments": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "file_name": {
                "anyOf": [
                  {
                    "maxLength": 1000,
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "has_attachment": {
                "type": "boolean"
              },
              "source": {
                "description": "Whether this draft uses a published template, a staged override, or no attachment.",
                "enum": [
                  "live",
                  "draft",
                  "none"
                ],
                "type": "string"
              },
              "stable_block_id": {
                "maxLength": 64,
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "stable_block_id",
              "has_attachment",
              "file_name",
              "source"
            ],
            "type": "object"
          },
          "maxItems": 1000,
          "type": "array"
        },
        "config": {
          "additionalProperties": false,
          "properties": {
            "application_runtime_structure": {
              "description": "Complete editable structure for the selected application runtime.",
              "type": "object"
            },
            "config_type": {
              "const": "application_runtime_structure",
              "description": "Document kind used to distinguish this config from other portable documents."
            },
            "config_version": {
              "const": 1,
              "description": "Version of the portable Runtime Editor config contract."
            }
          },
          "required": [
            "config_version",
            "config_type",
            "application_runtime_structure"
          ],
          "type": "object"
        },
        "config_source": {
          "enum": [
            "live",
            "draft"
          ],
          "type": "string"
        },
        "draft_revision": {
          "anyOf": [
            {
              "description": "Draft state token, or null before opening a draft.",
              "pattern": "^[0-9a-f]{64}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Draft state token, or null before opening a draft."
        },
        "frontend_link": {
          "anyOf": [
            {
              "format": "uri",
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "has_draft": {
          "description": "Whether your Portal has an editable draft.",
          "type": "boolean"
        },
        "live_revision": {
          "description": "Live form state token; preserve for the next reviewed change.",
          "pattern": "^[0-9a-f]{64}$",
          "type": "string"
        },
        "owner_kind": {
          "enum": [
            "client_intake",
            "deal",
            "matchmaking"
          ],
          "type": "string"
        },
        "owner_name": {
          "anyOf": [
            {
              "description": "Current application's owner display name.",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Current application's owner display name."
        },
        "owner_slug": {
          "anyOf": [
            {
              "description": "Canonical owning workspace ID. Use it as deal_id, business_id or workspace_slug in this editor.",
              "maxLength": 255,
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "Canonical owning workspace ID. Use it as deal_id, business_id or workspace_slug in this editor."
        },
        "provider_slug": {
          "description": "Stable public identifier for the referenced resource.",
          "maxLength": 255,
          "minLength": 1,
          "type": "string"
        },
        "runtime_slug": {
          "description": "Stable public identifier for the referenced resource.",
          "maxLength": 255,
          "minLength": 1,
          "pattern": "^apprun_[a-z0-9]+$",
          "type": "string"
        }
      },
      "required": [
        "owner_kind",
        "owner_slug",
        "owner_name",
        "frontend_link",
        "runtime_slug",
        "provider_slug",
        "has_draft",
        "config",
        "config_source",
        "attachments",
        "live_revision",
        "draft_revision"
      ],
      "type": "object"
    },
    "error": {
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "details": {
          "additionalProperties": true,
          "description": "Optional bounded, agent-safe correction or recovery facts.",
          "type": "object"
        },
        "message": {
          "type": "string"
        },
        "retryable": {
          "type": "boolean"
        }
      },
      "required": [
        "code",
        "message",
        "retryable"
      ],
      "type": "object"
    },
    "meta": {
      "additionalProperties": false,
      "properties": {
        "request_id": {
          "type": "string"
        }
      },
      "required": [
        "request_id"
      ],
      "type": "object"
    },
    "ok": {
      "description": "Whether the tool completed successfully.",
      "type": "boolean"
    }
  },
  "required": [
    "ok",
    "meta"
  ],
  "type": "object"
}
```

Check the result, then read the affected record to confirm your change.
