Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/invvd/mtg-cheaper-deck/llms.txt

Use this file to discover all available pages before exploring further.

The plain_text module provides a single function that serialises a list of deck entry dicts into the plain-text format recognised by most MTG deck builders. The output separates commanders from the rest of the deck, labels each section, and formats each line as quantity name. This shared utility is used by both the terminal-interactive mode and the web interface to produce a copyable decklist.
The output format is compatible with Moxfield’s deck import, Archidekt, Manastack, and most other MTG deck builders that accept plain-text lists. The Commander section header is optional — builders that don’t support commanders simply treat those lines as regular cards.

build_plain_text

Converts a list of deck entry dicts into a formatted plain-text decklist string.
entries
list[dict]
required
A list of deck entry dicts. Each dict must have three keys:
  • board (str) — the board the card belongs to. Entries with board == "commanders" are placed in the Commander section; all other boards ("mainboard", "companion", etc.) go in the Deck section.
  • quantity (int) — number of copies.
  • name (str) — card name as it should appear in the output.
Typically these are matched entries from match_deck_cards(), or modified copies where the name has been replaced with the chosen suggestion.
Returns str — a newline-joined string in the standard plain-text decklist format. If the deck contains any commanders, the string opens with a Commander section followed by a blank line, then the Deck section. If there are no commanders, the string starts directly with Deck.

Output format

Commander
1 Atraxa, Praetors' Voice

Deck
4 Counterspell
2 Sol Ring
1 Arcane Signet
...
Each line in a section is {quantity} {name}. The two sections are separated by a single blank line. There is no trailing blank line.

Usage example

from plain_text import build_plain_text

entries = [
    {"board": "commanders", "quantity": 1, "name": "Atraxa, Praetors' Voice"},
    {"board": "mainboard",  "quantity": 1, "name": "Sol Ring"},
    {"board": "mainboard",  "quantity": 1, "name": "Arcane Signet"},
    {"board": "mainboard",  "quantity": 4, "name": "Counterspell"},
]

text = build_plain_text(entries)
print(text)
Commander
1 Atraxa, Praetors' Voice

Deck
1 Sol Ring
1 Arcane Signet
4 Counterspell
To copy the output to the clipboard from a terminal on macOS:
python main.py https://moxfield.com/decks/YOUR-DECK-ID | pbcopy
On Linux with xclip:
python main.py https://moxfield.com/decks/YOUR-DECK-ID | xclip -selection clipboard

Build docs developers (and LLMs) love