AI agents &amp; MCP

### Agent guide

The workflow an AI agent should follow when reading, creating, or changing AIOD discounts over MCP.

If you are building or configuring an agent that uses the AIOD MCP server, follow this workflow rather than improvising one. AIOD’s configuration shapes are checked strictly and cannot be guessed, so the order below is what makes the difference between one clean call and five rejections.

### Navigate to header: The workflow The workflow

1

Find the discount

Use

shopify\_discount\_find

. Merchants refer to discounts in words; every other tool needs the

id

it returns. Never construct an id.

2

Read the schema before writing anything

Use

shopify\_discount\_config\_schema

for the template contracts. If this is an edit, also use

shopify\_discount\_get

for the values your patch is written against.

3

Pick the right template

One template per promotion, chosen from the contracts — not from what the promotion sounds like. See below.

4

Only set fields that template allows

Every template has an allowlist. Anything outside it is silently dropped before validation.

5

Validate before changing anything

Send it to

shopify\_discount\_draft

. It runs the same checks as publishing, and writes nothing.

6

Hand over the link

A draft is not live. Say so, every time.

7

Publish only when asked

shopify\_discount\_publish

creates a real Shopify discount, in test mode. It is not the natural next step after a successful draft. It only creates: it refuses a

targetDiscountId

.

### Navigate to header: Picking a template Picking a template

Read

contracts\_1

and

contracts\_2

before deciding. The short version:

| The merchant wants | Template |
| --- | --- |
| A discount that always applies to one target, with no real eligibility rule | specific\_item |
| A free item added separately from what the shopper is buying | unified\_free\_gift |
| Buy X get Y, where the shopper adds both X and Y and Y is price-reduced | bxgy |
| A set of items sold together at one flat price | bxgy\_fixed\_price |
| Anything applied to shipping or delivery | custom\_shipping |
| A threshold ladder — same condition, only the value rising | tiered\_unified |
| Quantity-only tiers on one shared scope, shown as bundle cards | volume\_bundle |
| Several tiers with genuinely different conditions and reward kinds | combined\_discount |
| A real eligibility condition, or several targets in one rule | custom\_discount |
| To block named discount codes when conditions are met | reject\_codes |

### Navigate to header: The two distinctions agents get wrong The two distinctions agents get wrong

Gift or BOGO?

unified\_free\_gift

is for a line the

app

inserts, or that the shopper picks from a gift picker. If the shopper adds every line themselves and Y is price-reduced, it’s

bxgy

. A gift is never something the customer has to add.

Tiered or combined?

tiered\_unified

is a ladder: same condition family, only the value changes. The moment tiers carry genuinely different, non-threshold conditions, it’s

combined\_discount

.

Upsell

is a real AIOD template with no contract and no editable fields, so no tool can create or edit it. When it’s the right fit, say so plainly and point the merchant at

setting it up by hand

. Never silently force the request into a different template.

### Navigate to header: Writing a configuration Writing a configuration

Send only what you’re setting. Configurations are sparse.

Creating needs a template . Editing needs only the changed fields — they merge onto the stored configuration rather than replacing it.

These shapes are AIOD’s own. They are not Shopify’s native discount API shapes and can’t be inferred from them.

Condition and reward syntax lives in conditions and actions\_and\_rules , not in the template contracts.

### Navigate to header: Editing an existing discount Editing an existing discount

1

Find it

shopify\_discount\_find

, usually with no

query

— the merchant’s wording rarely matches the stored title. Match on meaning, then confirm which discount you mean before changing anything.

2

Read it

shopify\_discount\_get

. The

saved

discount’s template decides which fields you may change — not your guess.

3

Patch it

shopify\_discount\_draft

with

targetDiscountId

and only the fields that change.

4

Hand over the link

Nothing is saved until the merchant opens it and saves.

### Navigate to header: When a call is rejected When a call is rejected

A

4xx

here is a result to read, not a broken connection.

Fix only the fields named in issues . Don’t rewrite the configuration.

The repair material comes with the rejection — schemaReference or fieldSyntaxReference . Use it instead of re-fetching the schema.

template\_field\_out\_of\_scope means stop. The setting genuinely isn’t editable for that template. Tell the merchant; don’t retry with those fields.

edit\_changed\_nothing means your patch missed the point. Re-read the current configuration and send the change you actually meant.

Full list on the

tools overview

.

### Navigate to header: Reporting back to the merchant Reporting back to the merchant

A draft creates nothing. Never describe it as live, created, or set up.

A publish creates a real discount in test mode , and an update puts an existing one back into test mode. Either way it applies only to the returned testModeEmail . Always surface that address, and always say a person has to switch it to active.

Zero orders on a new discount is normal. Attribution lags checkout briefly and the response says so. Don’t report it as broken.

Pass links through verbatim. They’re deep links into the merchant’s own Shopify admin.

### Navigate to header: What to say no to What to say no to

Say these plainly rather than working around them:

It cannot make a discount live, activate one, or delete one.

It cannot read orders, line items, customer records, or products.

It cannot report store-wide sales, sessions, or conversion — only per-discount totals.

It cannot reach any store other than the one that was approved.

It cannot see discount codes, or discounts created directly in Shopify or by another app.

### Navigate to header: Safety Safety

shopify\_discount\_update is destructive — it overwrites an existing discount and takes a live one out of service. Confirm in words first. Use it only when the merchant has asked for the change to be made in Shopify.

Prefer drafting whenever the merchant hasn’t explicitly asked for the discount to be created.

Never invent a setting, a template id, or a field name. If the schema doesn’t have it, say so.

[setting it up by hand](https://www.aiodapp.com/docs/templates/upsell)

[tools overview](https://www.aiodapp.com/docs/mcp-server/tools#rejections-are-useful-not-fatal)

[Navigate to header: The workflow](https://www.aiodapp.com/docs/mcp-server/agent-guide#the-workflow)

[Navigate to header: Picking a template](https://www.aiodapp.com/docs/mcp-server/agent-guide#picking-a-template)

[Navigate to header: The two distinctions agents get wrong](https://www.aiodapp.com/docs/mcp-server/agent-guide#the-two-distinctions-agents-get-wrong)

[Navigate to header: Writing a configuration](https://www.aiodapp.com/docs/mcp-server/agent-guide#writing-a-configuration)

[Navigate to header: Editing an existing discount](https://www.aiodapp.com/docs/mcp-server/agent-guide#editing-an-existing-discount)

[Navigate to header: When a call is rejected](https://www.aiodapp.com/docs/mcp-server/agent-guide#when-a-call-is-rejected)

[Navigate to header: Reporting back to the merchant](https://www.aiodapp.com/docs/mcp-server/agent-guide#reporting-back-to-the-merchant)

[Navigate to header: What to say no to](https://www.aiodapp.com/docs/mcp-server/agent-guide#what-to-say-no-to)

[Navigate to header: Safety](https://www.aiodapp.com/docs/mcp-server/agent-guide#safety)