Skip to main content
Glama
cryppadotta

Scryfall MCP Server

by cryppadotta

get_rulings

Retrieve official Magic: The Gathering card rulings by Scryfall ID or Oracle ID to clarify card interactions and resolve gameplay questions.

Instructions

Retrieve official rulings for a specified card by Scryfall ID or Oracle ID. Returns an array of rulings. Each ruling has a 'published_at' date and a 'comment' field.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesA Scryfall ID or Oracle ID. Example: 'c09c71fb-7acb-4ffb-a47b-8961a0cf4990'

Implementation Reference

  • The handler function that implements the get_rulings tool logic. It constructs the Scryfall API URL for rulings by card ID, fetches the data, and processes the response using the shared helper.
    async function handleGetRulings(id: string) {
      // Scryfall docs: /cards/{id}/rulings
      // Also works with /cards/{oracle_id}/rulings
      const url = `https://api.scryfall.com/cards/${encodeURIComponent(
        id
      )}/rulings`;
      const response = await fetch(url);
      return handleScryfallResponse(response);
    }
  • The Tool object definition including name, description, and inputSchema for validating the 'id' parameter.
    const GET_RULINGS_TOOL: Tool = {
      name: "get_rulings",
      description:
        "Retrieve official rulings for a specified card by Scryfall ID or Oracle ID. " +
        "Returns an array of rulings. Each ruling has a 'published_at' date and a 'comment' field.",
      inputSchema: {
        type: "object",
        properties: {
          id: {
            type: "string",
            description:
              "A Scryfall ID or Oracle ID. Example: 'c09c71fb-7acb-4ffb-a47b-8961a0cf4990'"
          }
        },
        required: ["id"]
      }
    };
  • index.ts:186-194 (registration)
    The array of all tools that is returned by the listTools handler, registering get_rulings among them.
    const SCRYFALL_TOOLS = [
      SEARCH_CARDS_TOOL,
      GET_CARD_BY_ID_TOOL,
      GET_CARD_BY_NAME_TOOL,
      RANDOM_CARD_TOOL,
      GET_RULINGS_TOOL,
      GET_PRICES_BY_ID_TOOL,
      GET_PRICES_BY_NAME_TOOL
    ] as const;
  • index.ts:389-392 (registration)
    The switch case in the CallToolRequest handler that dispatches calls to 'get_rulings' to the handleGetRulings function.
    case "get_rulings": {
      const { id } = args as { id: string };
      return await handleGetRulings(id);
    }
  • Shared helper function used by get_rulings (and other tools) to handle Scryfall API responses, including error parsing and JSON formatting.
    async function handleScryfallResponse(response: Response) {
      if (!response.ok) {
        // Attempt to parse Scryfall error
        let errorObj: ScryfallError | null = null;
        try {
          errorObj = (await response.json()) as ScryfallError;
        } catch {
          // fall back to generic
        }
        if (errorObj && errorObj.object === "error") {
          return {
            content: [
              {
                type: "text",
                text: `Scryfall error: ${errorObj.details} (code=${errorObj.code}, status=${errorObj.status})`
              }
            ],
            isError: true
          };
        } else {
          return {
            content: [
              {
                type: "text",
                text: `HTTP error ${response.status}: ${response.statusText}`
              }
            ],
            isError: true
          };
        }
      }
      // If okay, parse JSON
      const data = await response.json();
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2)
          }
        ],
        isError: false
      };
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses the return format (array of rulings with 'published_at' and 'comment' fields), which is helpful. However, it lacks details on error handling, rate limits, authentication needs, or whether this is a read-only operation (though 'retrieve' implies safe read). More behavioral context would improve transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded: the first sentence states the core purpose, and the second adds return details. Every sentence earns its place with no wasted words, making it efficient and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a simple input schema, the description is moderately complete. It covers purpose and return format, but lacks details on errors, pagination, or behavioral traits. For a retrieval tool with minimal structured data, it could be more comprehensive to aid the agent fully.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the 'id' parameter with examples. The description adds marginal value by specifying the parameter accepts Scryfall ID or Oracle ID, but doesn't provide additional semantics beyond what the schema states. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Retrieve official rulings for a specified card' with specific resources (rulings) and identifiers (Scryfall ID or Oracle ID). It distinguishes from siblings like get_card_by_id or get_prices_by_id by focusing on rulings rather than card data or prices. However, it doesn't explicitly differentiate from all siblings (e.g., search_cards might also return rulings).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when rulings are needed for a card, but provides no explicit guidance on when to use this tool versus alternatives like get_card_by_id (which might include rulings) or search_cards. No exclusions or prerequisites are mentioned, leaving usage context inferred rather than clearly defined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cryppadotta/scryfall-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server