mtg-edh-deckbuilder
简介
mtg-edh-deckbuilder
原始描述
Search and retrieve Magic: The Gathering card data using the Scryfall API. Use this skill when the user asks about MTG cards, wants to search for cards by name, type, color, mana cost, oracle text, set, or any other card attribute. Also use for getting card images, prices, rulings, legality information, or random cards. Triggers include mentions of MTG, Magic, Magic: The Gathering, card names, deck building questions, or requests for card information.
通过你的 Agent 添加
安装目录:scryfall-mtg/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: scryfall-mtg
description: "Search and retrieve Magic: The Gathering card data using the Scryfall API. Use this skill when the user asks about MTG cards, wants to search for cards by name, type, color, mana cost, oracle text, set, or any other card attribute. Also use for getting card images, prices, rulings, legality information, or random cards. Triggers include mentions of MTG, Magic, Magic: The Gathering, card names, deck building questions, or requests for card information."
Scryfall MTG Card Search
Search for Magic: The Gathering cards using the Scryfall API.
API Overview
Base URL: https://api.scryfall.com
Required Headers:
headers = {
"User-Agent": "OpenClawMTGSkill/1.0",
"Accept": "application/json"
}
Rate Limiting: Insert 50-100ms delay between requests (max 10 req/sec).
Core Endpoints
Search Cards
GET /cards/search?q={query}
Parameters:
q(required): Fulltext search queryunique: cards|art|prints (default: cards)order: name|set|released|rarity|color|usd|tix|eur|cmc|power|toughness|edhrec|penny|artist|reviewdir: auto|asc|descpage: Page number for pagination
Named Card Lookup
GET /cards/named?exact={name}
GET /cards/named?fuzzy={name}
GET /cards/named?exact={name}
GET /cards/named?fuzzy={name}
Use fuzzy for partial matches (e.g., "jac bele" → "Jace Beleren").
Add &set={code} to limit to specific set.
Random Card
GET /cards/random
GET /cards/random?q={query}
Card by ID
GET /cards/{id}
GET /cards/{set_code}/{collector_number}
Autocomplete
GET /cards/autocomplete?q={partial_name}
GET /cards/random
GET /cards/random?q={query}
GET /cards/{id}
GET /cards/{set_code}/{collector_number}
Autocomplete
GET /cards/autocomplete?q={partial_name}
GET /cards/autocomplete?q={partial_name}
Returns up to 20 card name suggestions.
Search Syntax Reference
See references/search_syntax.md for the complete search syntax guide.
Quick examples:
c:red pow=3- Red cards with power 3t:merfolk t:legend- Legendary merfolko:"draw a card"- Cards with "draw a card" in textcmc=3 r:rare- 3-mana rarese:dom- Cards from Dominariaf:standard- Standard legal cardsusd<1- Cards under $1
Implementation
Use the provided script for common operations:
python3 scripts/scryfall_search.py search "lightning bolt"
python3 scripts/scryfall_search.py named --exact "Black Lotus"
python3 scripts/scryfall_search.py random
python3 scripts/scryfall_search.py random --query "t:dragon"
Or make direct API calls with proper headers and rate limiting.
Card Object Key Fields
When displaying card info, prioritize these fields:
name,mana_cost,type_lineoracle_text,power,toughnessimage_uris.normal(for card image)prices.usd,prices.usd_foillegalities(format legality)set_name,rarity
For double-faced cards, check card_faces array.
Error Handling
- 404: Card not found
- 422: Invalid search query
- 429: Rate limited (wait and retry)
Always validate responses have object field; if object: "error", check details for message.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。