# Drawstep engine wiki — Tokens & token cards > The token spec inside createToken, the engine's predefined tokens, token cards designed in the Studio and used in decks, and how to write a creating card and its token card as a pair. Engine: Magic: The Gathering (`mtg`). Page: https://drawstep.xyz/wiki/mtg/tokens · Raw Markdown: https://drawstep.xyz/wiki/mtg/tokens.md · Complete AI pack (every topic in one document, with the output contract and worked examples): https://drawstep.xyz/wiki/drawstep-mtg-ai-pack.md. This page is generated from Drawstep's card schema; field names and discriminators are exact. A card definition is one JSON object; anything the vocabulary cannot express goes verbatim into `unparsed` instead of being approximated. ## Tokens and token cards A token is made by an effect; a **token card** is a card of its own that *is* that token — its art, its frame, its abilities — which your decks list and the table deals whenever one of your cards creates it. This page covers both: how a `createToken` effect describes what it makes, when to link it to a token card, and how an outside assistant writes the pair. **1. The token is described inside the effect.** The engine has no catalogue of "a 1/1 Soldier": every `createToken` carries a complete `token` object. ```json { "effect": "createToken", "who": "you", "amount": 2, "token": { "name": "Soldier", "types": ["Creature"], "subtypes": ["Soldier"], "colors": ["W"], "power": 1, "toughness": 1, "keywords": ["Vigilance"] } } ``` - `types` defaults to `["Creature"]`; `subtypes`; `colors` (omit or `[]` for colorless); `supertypes` (`["Legendary"]`); `power` / `toughness` — integers or values ("X/X" is `{ "kind": "var", "name": "X" }` on both; "with power and toughness each equal to the number of …" is a `count`, read once as the token is created, CR 111.3); `keywords` (plain ones); `keywordAbilities` (parametrised ones — `enchant`, `equip`, `ward`); `withCounters` ("enters with a +1/+1 counter"). - The token's quoted text — a 1/1 Devil "with 'When this creature dies, it deals 1 damage to any target'", a Treasure's "{T}, Sacrifice this artifact: …" — is the **token's own `abilities`** (the same ability objects a card has, with `filter: { "self": true }` meaning the token), never an ability of the creating card. `abilitiesInFollowingSentence: true` prints them as a following "It has …" sentence. Named tokens such as a Treasure are printed by name; the read-back prints an inline creature token in full ("a 1/1 red Devil creature token with …"), which is the line the Studio holds against the printed text. - The effect's own fields: `amount` (a value — "for each …" is a `count`); `tapped`; `attacking` (`true`, or `"defendingPlayer"`; "tapped and attacking" sets both); `who` / `target` (the player who creates it — "target opponent creates"); `attachedTo` ("create … attached to target creature"); and `token: { "oneOf": [ … ], "chooseAtRandom": true, "excludeControlled": true }` for "create a Food token or a Treasure token" / "one of the following at random you don't already control". - "Create a token that's a copy of …" is `createTokenCopy` (with `except` for "except it's …", `haste`, `tapped`, `attacking`) — a copy of the object, never a `createToken` with the original's characteristics typed in. **2. Predefined tokens the engine ships.** Treasure, Food, Clue, Map and Incubator are the engine's own definitions: name them with `tokenDefId` and nothing else — `{ "name": "Treasure", "tokenDefId": "token-treasure" }` — and the token has its printed ability at the table. The ids are `token-treasure`, `token-food`, `token-clue`, `token-map`, `token-incubator` (the `incubate` effect uses it itself), `token-monster-role` and `token-spirit` (a 1/1 white Spirit with flying). Every other named token — Blood, Powerstone, Gold, Junk, the other Roles — is written inline with its ability spelled out; the read-back still prints it by name. **3. Token cards — your own token definitions.** In the Studio, **New token** in the library panel (or the **Token** box in the Frame panel) makes a card with `layout: "token"` and no `manaCost`: a face, art, a frame, and the token's abilities written exactly as on any card. Its id is assigned when it is saved — `custom::`, say `custom:ed6ec723:devil` — and from then on it is in three places: the **Your token cards…** picker on every `createToken` block, which writes the `tokenDefId` link and fills the spec from the card; the **Tokens** zone of the deck builder, where it is offered first for each creating card in the deck ("Add your token card"); and the table, where a linked `createToken` deals the token card itself — its art, its abilities — rather than the inline spec. **Link and inline, not link or inline.** Always write the inline spec: it is what the read-back prints (a `tokenDefId` with no `types` prints only as "a Devil token"), what a replacement's `tokenFilter` inspects, and what the engine falls back to when the token card is not at the table (deleted, or never shared with that table). Add `tokenDefId` on top when a token card exists or is written alongside; at the table the token card's abilities win over the inline ones, so keep them the same. **4. Writing the pair from outside (ChatGPT, Claude, Gemini …).** An outside assistant cannot know the id a token card will be given, so it writes the reference by name and the server reconciles it on save: - **The token card**: a normal card object with `"layout": "token"`, an `id` that is the lower-case name (`"devil"`), **no `manaCost`**, its `types` / `subtypes` / `colors` / `power` / `toughness` / `keywords`, its `text` and its `abilities`. - **The creating card**: `createToken` with the full inline spec **and** `"tokenDefId": "devil"` — the same slug (`"Devil"`, `"devil-token"` and `"Devil Token"` all resolve; a `custom:…` id you already have is kept as written). - Return both as **two JSON objects** in separate ```json fences; the Studio's **Import** opens one tab each. Save them in either order: when a card is saved the server rewrites every `tokenDefId` that is not a stock id to your token card with that id, that slug or that name (minus "token"), and saving a token card re-links the cards you saved before it. A reference nothing matches is left as written and the inline spec is used (the Studio's picker shows it as "(not in your library)"). - A token the creating card could describe in a line (a vanilla 1/1 Soldier, a 2/2 Zombie) needs no token card; one is worth making when the token has art of its own, text of its own, or several of your cards create it. **Worked example — a creature and the Devil it creates.** Both validate as written; together they are what an outside assistant hands back for the printed card. ```json { "id": "devil", "name": "Devil", "source": "custom", "layout": "token", "types": ["Creature"], "subtypes": ["Devil"], "colors": ["R"], "power": 1, "toughness": 1, "text": "When this creature dies, it deals 1 damage to any target.", "abilities": [ { "kind": "triggered", "trigger": { "event": "dies", "filter": { "self": true } }, "effects": [ { "effect": "dealDamage", "target": { "of": "any" }, "amount": 1 } ] } ] } ``` ```json { "id": "avernus-kennelmaster", "name": "Avernus Kennelmaster", "source": "custom", "layout": "normal", "types": ["Creature"], "subtypes": ["Devil", "Shaman"], "manaCost": "{2}{R}", "colors": ["R"], "power": 2, "toughness": 2, "text": "When Avernus Kennelmaster enters, create a 1/1 red Devil creature token with \"When this creature dies, it deals 1 damage to any target.\"", "abilities": [ { "kind": "triggered", "trigger": { "event": "enters", "filter": { "self": true } }, "effects": [ { "effect": "createToken", "who": "you", "amount": 1, "token": { "name": "Devil", "tokenDefId": "devil", "types": ["Creature"], "subtypes": ["Devil"], "colors": ["R"], "power": 1, "toughness": 1, "abilities": [ { "kind": "triggered", "trigger": { "event": "dies", "filter": { "self": true } }, "effects": [ { "effect": "dealDamage", "target": { "of": "any" }, "amount": 1 } ] } ] } } ] } ] } ``` The engine reads the creating card back as “When Avernus Kennelmaster enters, create a 1/1 red Devil creature token with "When this token dies, it deals 1 damage to any target."” — the printed line, which is what Import checks. Once both are saved, `tokenDefId` is the Devil card's id, the deck builder offers the Devil card for the Kennelmaster, and the table deals it with the Devil's own art. **Tokens in a deck.** The deck builder's **Tokens** zone lists the token cards and stock token proxies a deck wants — display and proxies only; the game creates tokens from the cards' effects. Every custom card you own, token cards included, is in the pool of any table you sit at.