Magic: The Gathering Card Lookup Service: Querying Chinese MTG Cards in an Agent

Introduction

When playing Magic: The Gathering, writing decklist reviews, or building deck-related automation, you often find yourself going back and forth between web pages and databases looking up card names, sets, rules text, and collector numbers. Embedding lookups into a conversational Agent requires a stable tool interface and a return strategy that prioritizes Chinese-language card data. Below is an overview of the MTG Card Lookup Service on SkillHub: it encapsulates MTG lookup capabilities into an Agent Skill compliant with the SKILL.md specification. The Agent selects and invokes the appropriate tool, calling the Xiaobenyang-side API—rather than hard-coding card data into prompts.

What Is This

The MTG Card Lookup Service is identified by the package coordinate @org-rn88lg3j/gathering-card-lookup, currently at version 1.0.0, published by Xiaobenyang Technology. It is categorized as ai-agent on SkillHub, with the source labeled as enterprise. The official description matches the in-Skill description: a server-side capability implemented on the Model Context Protocol (MCP) paradigm, targeting lookup and search of Chinese-language Magic: The Gathering card information.

On SkillHub, the Skill page is available at https://www.skillhub.cn/skills/org-rn88lg3j/gathering-card-lookup, and the API endpoint is https://api.skillhub.cn/org-rn88lg3j/gathering-card-lookup. The page tags indicate requires_api_key=true; you need a Xiaobenyang API key before use (the Skill documentation points to https://xiaobenyang.com to obtain one).

Core Features

The SKILL.md inside the package defines the Agent as a “routing layer”: understand user intent → select a function from scripts.tools → invoke it with keyword arguments → present the returned raw JSON to the user in a readable form. The declared tools are as follows.

User Intent Tool Function
Look up a single card by set code + collector number scripts.tools.get_card_by_set_and_number
Search cards with query syntax (pagination, sorting) scripts.tools.search_cards
List all sets (descending by release date) scripts.tools.get_sets
Get set details by set code scripts.tools.get_set
List all cards in a given set scripts.tools.get_set_cards
Compose a sentence from card images (hzls) scripts.tools.hzls

search_cards and get_set_cards support common Scryfall-style queries with pagination. The documentation provides the following query examples:

  • t:creature c:r (red creatures)
  • pow>=5 or mv<2
  • o:"draw a card" -c:u
  • (t:instant or t:sorcery) mv<=3

Pagination and sorting: page defaults to 1; page_size defaults to 20 with a maximum of 100; order accepts comma-separated fields, with a - prefix indicating descending order. Additionally, unique (id / oracle_id / illustration_id) and priority_chinese (whether to prioritize Chinese-language card faces, default true).

The tool return structure is a dictionary: success, message, and raw (the raw API JSON) intended for presentation to the user.

Installation & Activation

Install SkillHub CLI

If you haven’t installed the CLI yet, check the version first:

command -v skillhub && skillhub --version

If not installed, follow the SkillHub installation guide for a full setup:

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

Install This Skill

The SkillHub skill page instructs: follow the installation guide above to install @org-rn88lg3j/gathering-card-lookup. The CLI search results show the install command as:

skillhub install gathering-card-lookup --namespace org-rn88lg3j --dir <your Agent skills directory>

--dir must point to the skills directory that your current Agent actually reads from; otherwise it will default to ./skills/, which may not be loaded. Common paths (from the official installation docs):

  • Cursor: ~/.cursor/skills/
  • Claude Code: ~/.claude/skills/
  • Codex: ~/.codex/skills/ or .agents/skills/ under the project

After installation, refresh or restart the client as required to activate the Skill.

Configure the API Key

The Skill mandates an API key (requires_api_key=true). The workflow is as follows:

  1. Set XBY_APIKEY=your_key in the .env file within the Skill working directory, and/or persist it via scripts.config.set_api_key(api_key).
  2. If scripts.config.settings.api_key is empty, the Agent should use AskUserQuestion to request the key from the user. Fabricating card data without a key is forbidden.

The bundled API client defaults to requesting https://mcp.xiaobenyang.com (a valid key is required). Python dependencies are listed in requirements.txt within the package; install them in the Skill directory before deployment.

Typical Usage

The following workflows are drawn from the “Workflow” section and tool documentation inside the Skill. Once the Skill is activated, they can be triggered via natural language, with the Agent handling the implementation.

1. Look Up a Single Card by Number

The user specifies a set code and collector number, e.g., set NEO, number 112. The Agent should call:

scripts.tools.get_card_by_set_and_number(set="NEO", collector_number="112")

2. Conditional Search

When the user asks for “red creatures” or a complex query, the Agent calls search_cards, e.g.:

scripts.tools.search_cards(
    q="t:creature c:r",
    page=1,
    page_size=20,
    priority_chinese=True,
)

3. Browse Sets

List all sets with get_sets(); get a single set’s details with get_set(set_code="MOM"); list cards in that set with get_set_cards(set_code="MOM", page=1, page_size=20).

4. hzls (Card-Art Sentence Composition)

To compose a sentence using card images, call hzls(target_sentence="…"), with optional cut_full_image and with_link parameters.

On success, format result["raw"] into a readable response; on failure, explain the cause based on success and message (commonly a missing key or an API error).

Use Cases & Caveats

Who It’s For

  • Players, writers, or developers who need to look up Chinese-language MTG card faces and set information conversationally in environments like Cursor, Claude Code, or Codex.
  • Scenarios where you want the Agent to use a structured API rather than “guessing” cards from training data.

Limitations & Notes

  1. A Xiaobenyang API key is required. Without a key, the Skill explicitly instructs the Agent to ask the user; fabricating query results is not permitted.
  2. This is an Agent Skill (scripts.tools + HTTP API), invoked by the Agent per SKILL.md during conversation. If you use a pure MCP client, you’ll need to wire up the integration yourself by referencing the Skill package.
  3. SkillHub metadata shows a score of 100000, 836 downloads, and 0 installs (statistics change with platform updates).
  4. External network access to mcp.xiaobenyang.com and the SkillHub download source is required.

Closing

The MTG Card Lookup Service consolidates Chinese-language MTG search, set browsing, and card-art sentence composition into a set of Agent-callable tools, and reduces hallucination through handbook-level query syntax and parameter constraints. If you’re building a deck assistant, a card encyclopedia, or a content-creation pipeline, install @org-rn88lg3j/gathering-card-lookup from SkillHub, configure XBY_APIKEY, and use it directly in your Agent conversation.

Official page: https://www.skillhub.cn/skills/org-rn88lg3j/gathering-card-lookup

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye