Skip to main content

MTG Commander Deck Analyzer - Decode the secrets of your Commander deck

Project description

Tome - MTG Commander Deck Analyzer

Tome is a Python CLI tool that analyzes Commander decklists against best practices, combining rule-based heuristics validation with LLM-powered strategic analysis using the Scryfall API for card data and Claude API for intelligent recommendations.

Features

Deck Analysis

  • Decklist Parsing: Supports multiple common formats (Moxfield, MTGO, simple text)
  • Moxfield URL Support: Analyze decks directly from Moxfield URLs
  • Flexible Deck Size: Analyze incomplete (<100) or oversized (>100) decks with suggestions
  • Scryfall Integration: Automatic card data retrieval with 30-day local caching

Heuristic Validation

Checks your deck against established Commander best practices:

  • Land count and mana base analysis
  • Ramp spells (8-10 recommended)
  • Card draw (10+ recommended)
  • Removal and board wipes
  • Instant-speed interaction
  • Graveyard hate
  • Color fixing analysis per color

Budget Analysis

  • Total deck cost calculation
  • Identifies expensive cards (>10% of budget)
  • Budget category classification (Ultra-Budget to No-Budget)

LLM Strategic Analysis

  • Claude-powered insights on theme, synergies, and improvements
  • Interactive chat mode for follow-up questions
  • Context-aware recommendations based on your deck's strengths and weaknesses

Interactive Deck Modification

  • Add cards: add Sol Ring or add Rhystic Study x2
  • Remove cards: remove Temple of the False God
  • Swap cards: swap Diabolic Tutor for Demonic Tutor
  • Batch add/remove: paste multiple card names at once
  • Export updated decklist in Moxfield-compatible format

Collection Comparison

  • Compare your deck against your existing card collection
  • AI-powered swap suggestions that understand card synergies
  • Find budget savings: cards you own that could replace expensive cards
  • Find upgrades: better cards you already have
  • Interactive swap acceptance: accept 1 or accept all budget

Installation

Quick Install (Recommended)

pip install tome-mtg

API Key Setup

When you first run Tome without an API key, it will prompt you to paste one and offer to save it for future sessions.

Or set it manually:

# On Windows (PowerShell)
$env:ANTHROPIC_API_KEY = "your_api_key_here"

# On macOS/Linux
export ANTHROPIC_API_KEY=your_api_key_here

Or create a .env file in your working directory:

ANTHROPIC_API_KEY=your_api_key_here

Get your API key from: https://console.anthropic.com/

Install from Source

git clone https://github.com/kliszaj/tome.git
cd tome
pip install -e .

Usage

Basic Analysis

tome analyze my_deck.txt

Options

tome analyze my_deck.txt --compact              # Use compact banner
tome analyze my_deck.txt --collection cards.txt # Compare against collection
tome analyze my_deck.txt -c cards.txt --compact # Both options

Decklist Format

The analyzer supports multiple formats:

// Commander section (optional)
Commander:
1 Korvold, Fae-Cursed King

// Main deck
Deck:
1 Sol Ring
1x Arcane Signet
1 x Command Tower
Blasphemous Act

// Comments are supported
// Lines starting with // or # are ignored

Supported formats:

  • 1x Card Name or 1 x Card Name
  • 1 Card Name
  • Card Name (assumes quantity 1)

Example Output

╔═══════════════════════════════════════╗
║  Korvold, Fae-Cursed King             ║
║  Commander: Korvold, Fae-Cursed King  ║
╚═══════════════════════════════════════╝

DECK OVERVIEW
Total Cards: 100
Average CMC: 3.2 (non-land)
Color Identity: B/R/G

HEURISTIC CHECKLIST
┌──────────────┬────────┬──────────┬────────┐
│ Category     │ Count  │ Expected │ Status │
├──────────────┼────────┼──────────┼────────┤
│ Lands        │ 38     │ 37-39    │   ✓    │
│ Ramp         │ 10     │ 8-10     │   ✓    │
│ Card Draw    │ 9      │ 10+      │   ✗    │
│ Removal      │ 8      │ ~8       │   ✓    │
│ Board Wipes  │ 4      │ 3-5      │   ✓    │
└──────────────┴────────┴──────────┴────────┘

MANA CURVE
  0 | ██ 2
  1 | ████ 4
  2 | ████████████████ 14
  3 | ████████████████ 14
  4 | ████████████ 10
  5 | ████████ 7
  6 | ████ 4
 7+ | ██ 2

Average CMC: 3.2

Collection Comparison

Compare your deck against cards you already own:

tome analyze my_deck.txt --collection my_collection.txt

The collection file uses the same format as deck files. Tome will suggest:

  • Budget swaps: expensive cards that can be replaced with cheaper cards you own
  • Upgrades: better cards you already have

Interactive Commands

After analysis, you enter interactive mode:

> add Sol Ring              # Add a card
> remove Island             # Remove a card
> swap Card A for Card B    # Swap cards
> show swaps                # Show collection swap suggestions
> accept 1                  # Accept swap suggestion #1
> accept all budget         # Accept all high-confidence budget swaps
> summary                   # Show modifications made
> export                    # Export updated decklist
> quit                      # Exit

You can also ask questions about your deck:

> What cards should I cut for more draw?
> Is this deck too slow?
> Should I add more ramp or cut lands?

Cost Estimates

  • Scryfall API: Free (with rate limiting)
  • Claude Analysis: ~$0.05 per deck analysis
  • Interactive Questions: ~$0.01-0.02 per question

Troubleshooting

"Card not found in Scryfall"

The tool uses fuzzy matching, but some card names may not be recognized. Double-check spelling or try the exact name from Scryfall.

Import errors

Make sure you've installed the package correctly:

pip install tome-mtg

License

MIT License - Free to use and modify.

Credits

  • Scryfall: Card data provided by Scryfall API
  • Anthropic: LLM analysis powered by Claude API

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tome_mtg-1.1.1.tar.gz (53.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tome_mtg-1.1.1-py3-none-any.whl (55.7 kB view details)

Uploaded Python 3

File details

Details for the file tome_mtg-1.1.1.tar.gz.

File metadata

  • Download URL: tome_mtg-1.1.1.tar.gz
  • Upload date:
  • Size: 53.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for tome_mtg-1.1.1.tar.gz
Algorithm Hash digest
SHA256 dfe987267de8f737895b02ac1e0cb48aeb3824d27a910b7c33711b73a8466c5f
MD5 e4bc9747f63ebedd48c61e7452014e58
BLAKE2b-256 6543ea489627554c3cbaba8a9322befaac0bc71cb7dafb3acd36dadd714155b9

See more details on using hashes here.

File details

Details for the file tome_mtg-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: tome_mtg-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 55.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for tome_mtg-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bb19dfc4c18bedd559686540d65e9f3ba8e71c4628dd93e8cad31babb61348e3
MD5 4e861949e20b3702b55c3a0d46a9ac71
BLAKE2b-256 01d5b20cd4369fa072a0631dd88ce489a5616a7acc3fc1cd24bfcbad635cfbc3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page