# Replace deal package

`deal_packages.replace`

Replace the complete package draft. Read get_config and get_config_schema, preserve unrelated settings, and validate_config first. Pass get_config.revision; publication remains separate.

[Deal packages guide](https://docs.levr.ai/mcp/resources/deal_packages.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": {
    "client_request_id": {
      "maxLength": 255,
      "minLength": 1,
      "type": "string"
    },
    "config": {
      "description": "Complete document described by deal_packages.get_config_schema.",
      "type": "object"
    },
    "expected_revision": {
      "description": "Copy revision from deal_packages.get_config, or checkout_config for staged edits.",
      "minimum": 0,
      "type": "integer"
    },
    "package_slug": {
      "description": "Copy package_slug from deal_packages.list. Prefix: pkg_.",
      "maxLength": 255,
      "minLength": 1,
      "type": "string"
    },
    "provider_slug": {
      "description": "Copy provider_slug from providers.list; named slugs are valid.",
      "maxLength": 255,
      "minLength": 1,
      "type": "string"
    }
  },
  "required": [
    "provider_slug",
    "package_slug",
    "expected_revision",
    "client_request_id",
    "config"
  ],
  "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": {
        "change_summary": {
          "maxLength": 255,
          "type": "string"
        },
        "digest": {
          "pattern": "^[a-f0-9]{64}$",
          "type": "string"
        },
        "frontend_link": {
          "format": "uri",
          "type": "string"
        },
        "package_slug": {
          "description": "Canonical pkg_ identifier; copy the returned value unchanged.",
          "maxLength": 255,
          "minLength": 1,
          "type": "string"
        },
        "revision": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "package_slug",
        "revision",
        "digest",
        "frontend_link",
        "change_summary"
      ],
      "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.
