> ## Documentation Index
> Fetch the complete documentation index at: https://aiodapp.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Read the discount schema

> shopify_discount_config_schema returns AIOD's discount templates, condition operators, and reward shapes — read it before building any discount.

Returns the rules a discount has to be built against: the templates, the condition operators, and the reward shapes.

<Info>
  **Tool name:** `shopify_discount_config_schema` · **Previously:** `get_aiod_context` · **Read-only, touches no store data**
</Info>

## When to use it

**Before writing any configuration**, every time.

These shapes belong to AIOD. They are not Shopify's native discount API shapes, and they cannot be worked out from them. A guessed configuration gets rejected, not quietly corrected — so reading first is faster than guessing and retrying.

This is static reference text. It reads nothing from the store.

## Parameters

| Name      | Type   | Required | What it does                                   |
| --------- | ------ | -------- | ---------------------------------------------- |
| `section` | string | No       | Which part to read. Defaults to `contracts_1`. |

### The sections

| Section                    | What's in it                                                                                                                                                 |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `contracts_1`              | **Start here.** The templates, and which fields each one lets you set.                                                                                       |
| `contracts_2`              | The rest of the templates.                                                                                                                                   |
| `conditions`               | How to express a condition: cart subtotal and quantity, products, variants, collections, customer tags and segments, market, location, purchase type, dates. |
| `actions_and_rules`        | How to express a reward: percentage and amount off, free and discounted gifts, shipping rewards, tier ladders.                                               |
| `schema`                   | The overall shape a configuration takes.                                                                                                                     |
| `examples_1`, `examples_2` | Worked configurations.                                                                                                                                       |
| `core`                     | The in-app assistant's own system prompt. Almost no schema in it — exposed only for completeness.                                                            |

<Warning>
  The underlying route defaults to `core` when no section is given, which is nearly useless for building a discount. The MCP tool overrides that to `contracts_1`. Pass a section explicitly whenever you want something else.
</Warning>

## What comes back

```json theme={null}
{
  "section": "contracts_1",
  "availableSections": ["core", "contracts_1", "contracts_2", "conditions", "actions_and_rules", "schema", "examples_1", "examples_2"],
  "context": "### unified_free_gift — Free gift with purchase\n..."
}
```

`context` is Markdown reference text, not JSON. It comes in sections because the whole thing is several times larger than one tool response can carry.

## The templates

Each contract gives you the template's id, its discount type, exactly which fields you may set, any values that are fixed for you, and its constraints.

| Template id         | What it's for                                                 | Type        |
| ------------------- | ------------------------------------------------------------- | ----------- |
| `specific_item`     | A discount that always applies to one target                  | `automatic` |
| `unified_free_gift` | A free item added separately from what the shopper is buying  | `gift`      |
| `bxgy`              | Buy X get Y, where the shopper adds every line themselves     | `automatic` |
| `bxgy_fixed_price`  | A set of items for one flat combined price                    | `automatic` |
| `custom_shipping`   | Anything applied to shipping or delivery                      | `shipping`  |
| `custom_discount`   | The general-purpose builder, for real eligibility conditions  | `automatic` |
| `reject_codes`      | Blocking named discount codes when conditions are met         | `automatic` |
| `tiered_unified`    | A threshold ladder — same condition, rising values            | `tiered`    |
| `volume_bundle`     | Quantity tiers on one shared scope, shown as bundle cards     | `tiered`    |
| `combined_discount` | Several tiers with genuinely different conditions and rewards | `tiered`    |

<Note>
  **Upsell** is a real AIOD template, but it has no contract and no editable fields, so no tool can create or edit it. When Upsell is the right answer, say so and point the merchant at [setting it up by hand](/docs/templates/upsell) — don't force the request into a different template.
</Note>

## Things to watch out for

* **Read `contracts_1` before choosing**, and read the chosen template's contract before writing a single field.
* **Only fields on a template's allowlist survive.** Everything else is silently dropped before validation — which is how an edit ends up rejected for "changing nothing".
* **Condition and reward syntax is not in the contracts.** It's in `conditions` and `actions_and_rules`. Fetch those when a simulation failure names a field shape.
