MTG Copilot Docs
Data model

Cards

One row per Magic card as a game object: rules text, cost, legality. Independent of how many times it has been printed.

40 columns. Every value below is generated from the provenance registry.

FieldTypeSourceUpdatedWritten by
idstringcalculatedneverdatabase
Internal UUID primary key (distinct from Scryfall ids).
scryfall_oracle_idstringscryfallon set releasescripts/seed-cards.ts
Scryfall oracle id — the stable per-card identity used for all external joins.
namestringscryfallon set releasescripts/seed-cards.ts
Card name (front-face name for multi-face cards).
mana_coststring | nullscryfallon set releasescripts/seed-cards.ts
Mana cost in brace notation, e.g. {2}{W}{U}.
cmcnumberscryfallon set releasescripts/seed-cards.ts
Mana value (converted mana cost).
type_linestringscryfallon set releasescripts/seed-cards.ts
Full type line, e.g. 'Legendary Creature — Human Wizard'.
oracle_textstring | nullscryfallon set releasescripts/seed-cards.ts
Oracle rules text (front face for multi-face cards).
colorsstring[]scryfallon set releasescripts/seed-cards.ts
Card colors (WUBRG letters).
color_identitystring[]scryfallon set releasescripts/seed-cards.ts
Commander color identity (WUBRG letters).
keywordsstring[]scryfallon set releasescripts/seed-cards.ts
Keyword abilities, e.g. Flying, Trample.
produced_manastring[] | nullscryfallon set releasescripts/seed-cards.ts
Mana colors this card can produce, per Scryfall.
layoutstringscryfallon set releasescripts/seed-cards.ts
Scryfall layout, e.g. normal, transform, modal_dfc, adventure.
legalitiesJsonscryfallon set releasescripts/seed-cards.ts
Per-format legality map (commander, modern, …).
loyaltystring | nullscryfallon set releasescripts/seed-cards.ts
Planeswalker starting loyalty (string; can be 'X').
powerstring | nullscryfallon set releasescripts/seed-cards.ts
Creature power (string; can be '*', 'X').
toughnessstring | nullscryfallon set releasescripts/seed-cards.ts
Creature toughness (string; can be '*', 'X').
defensestring | nullscryfallon set releasescripts/seed-cards.ts
Battle defense value.
raritystring | nullscryfallon set releasescripts/seed-cards.ts
Rarity of the representative printing.
reservedbooleanscryfallon set releasescripts/seed-cards.ts
Reserved List membership.
scryfall_uristring | nullscryfallon set releasescripts/seed-cards.ts
Canonical Scryfall page URL.
source_hashstring | nullcalculatedon set releasescripts/seed-cards.ts
Digest of the Scryfall fields describing this card, used to skip rows that have not changed. Excludes prices, image URLs and penny legality, each of which moves for reasons unrelated to the card.
purchase_urisJson | nullscryfallon set releasescripts/seed-cards.ts
Vendor purchase URLs from Scryfall (TCGplayer etc.).
all_partsJson | nullscryfallon set releasescripts/seed-cards.ts
Related card parts (tokens, meld pairs, adventures) from Scryfall.
card_facesJson | nullscryfallon set releasescripts/seed-cards.ts
Per-face data for multi-face cards (names, texts, images).
default_image_urlstring | nullscryfallon set releasescripts/seed-cards.ts
Representative card image URL (front face, normal size).
card_typesstring[] | nullcalculatedon writedatabase
Main card types parsed from type_line (Creature, Instant, …).
supertypesstring[] | nullcalculatedon writedatabase
Supertypes parsed from type_line (Legendary, Basic, Snow, …).
subtypesstring[] | nullcalculatedon writedatabase
Subtypes parsed from type_line (Elf, Equipment, Aura, …); denormalized from card_subtypes.
oracle_text_searchstring | nullcalculatedon writedatabase
GENERATED column concatenating oracle_text with all face texts for whole-card text search.
embeddingstring | nullaion demandscripts/embed-cards.ts
Voyage voyage-3 embedding truncated to 256d, for pgvector re-ranking.
tagsstring[]calculatedon writedatabase
Curated semantic tags (game_concepts vocabulary), denormalized from card_concept_associations by trigger. A concept a maintainer rejected is excluded whichever pass asserts it.
embedding_stalebooleancalculatedon writedatabase
Set when the trigger changes this card's tags, so the next embed:cards run refreshes the vector. Cleared as that run writes.
set_codesstring[] | nullcalculatedon set releaserefresh_card_set_codes() SQL fn (after a printings seed)
Set codes this card's oracle has been printed in, denormalized from card_printings for the search set:/e: token.
context_associationsstring[] | nullaion demandscripts/classify-cards-*.ts (tag pipeline)
Concept associations used to ground AI context resolution.
leadership_skillsJson | nullmtgjsonon set releasescripts/ingest-mtgjson.ts (enrich)
MTGJSON leadershipSkills jsonb ({commander, brawl, oathbreaker, pauper_commander, predh}); NULL = no leadership data.
has_alternative_deck_limitboolean | nullmtgjsonon set releasescripts/ingest-mtgjson.ts (enrich)
Ignores the 1-copy deck limit (Relentless Rats etc.); NULL = no.
game_changerboolean | nullmtgjsonon set releasescripts/ingest-mtgjson.ts (enrich)
WotC Commander-brackets Game Changer list membership; NULL = no.
edhrec_saltinessnumber | nullmtgjsonon set releasescripts/ingest-mtgjson.ts (enrich)
EDHREC community saltiness score (0..1); NULL = unrated.
created_atstringcalculatedneverdatabase
Row creation timestamp.
updated_atstringcalculatedon writedatabase
Last row update timestamp.

TypeScript model

interface cards {
  id:                         string
  scryfall_oracle_id:         string
  name:                       string
  mana_cost:                  string | null
  cmc:                        number
  type_line:                  string
  oracle_text:                string | null
  colors:                     string[]
  color_identity:             string[]
  keywords:                   string[]
  produced_mana:              string[] | null
  layout:                     string
  legalities:                 Json
  loyalty:                    string | null
  power:                      string | null
  toughness:                  string | null
  defense:                    string | null
  rarity:                     string | null
  reserved:                   boolean
  scryfall_uri:               string | null
  source_hash:                string | null
  purchase_uris:              Json | null
  all_parts:                  Json | null
  card_faces:                 Json | null
  default_image_url:          string | null
  card_types:                 string[] | null
  supertypes:                 string[] | null
  subtypes:                   string[] | null
  oracle_text_search:         string | null
  embedding:                  string | null
  tags:                       string[]
  embedding_stale:            boolean
  set_codes:                  string[] | null
  context_associations:       string[] | null
  leadership_skills:          Json | null
  has_alternative_deck_limit: boolean | null
  game_changer:               boolean | null
  edhrec_saltiness:           number | null
  created_at:                 string
  updated_at:                 string
}

On this page