Skip to main content
Glama
cryppadotta

Scryfall MCP Server

by cryppadotta

get_card_by_id

Retrieve Magic: The Gathering card data using its unique Scryfall ID. Returns detailed card information in JSON format for accurate card lookup.

Instructions

Retrieve a card by its Scryfall ID (a 36-char UUID). Returns the card data in JSON.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe Scryfall UUID, e.g. 'c09c71fb-7acb-4ffb-a47b-8961a0cf4990'

Implementation Reference

  • The main handler function that fetches the card from Scryfall API using the provided ID and returns the processed response.
    async function handleGetCardById(id: string) {
      const url = `https://api.scryfall.com/cards/${encodeURIComponent(id)}`;
      const response = await fetch(url);
      return handleScryfallResponse(response);
    }
  • Tool schema definition including name, description, and input schema requiring a string 'id' parameter.
    const GET_CARD_BY_ID_TOOL: Tool = {
      name: "get_card_by_id",
      description:
        "Retrieve a card by its Scryfall ID (a 36-char UUID). Returns the card data in JSON.",
      inputSchema: {
        type: "object",
        properties: {
          id: {
            type: "string",
            description:
              "The Scryfall UUID, e.g. 'c09c71fb-7acb-4ffb-a47b-8961a0cf4990'"
          }
        },
        required: ["id"]
      }
    };
  • index.ts:186-194 (registration)
    Registration of the tool in the SCRYFALL_TOOLS array, which is returned by the listTools handler.
    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:378-381 (registration)
    Dispatch case in the callToolRequest handler that invokes the get_card_by_id handler.
    case "get_card_by_id": {
      const { id } = args as { id: string };
      return await handleGetCardById(id);
    }
  • Shared helper function to process Scryfall API responses, handling errors and formatting JSON output.
    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?

With no annotations provided, the description carries the full burden. It discloses the return format ('JSON') and ID format requirement ('36-char UUID'), which is useful context. However, it doesn't mention error behavior, rate limits, authentication needs, or what happens with invalid IDs - significant gaps for a tool with zero annotation coverage.

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 perfectly concise - two sentences that each earn their place. The first sentence states the complete purpose and method, the second specifies the return format. No wasted words, front-loaded with the core functionality.

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?

For a simple read operation with one parameter and no output schema, the description covers the basics but has gaps. It explains what the tool does and returns, but lacks information about error cases, response structure details, or performance characteristics. Without annotations, it should provide more behavioral context for a complete understanding.

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

Parameters4/5

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

With 100% schema description coverage and only one parameter, the schema already fully documents the 'id' parameter. The description adds minimal value by reinforcing the ID format ('36-char UUID') and calling it a 'Scryfall ID', but doesn't provide additional semantic context beyond what the schema offers. Baseline for high schema coverage with single parameter is 4.

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

Purpose5/5

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

The description clearly states the specific action ('Retrieve'), resource ('a card'), and method ('by its Scryfall ID'), distinguishing it from siblings like get_card_by_name (name-based) and get_prices_by_id (price-focused). It provides complete purpose information in a single sentence.

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 you have a Scryfall UUID, but doesn't explicitly state when to use this tool versus alternatives like get_card_by_name (for name lookups) or search_cards (for broader searches). No explicit exclusions or alternative recommendations are provided.

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