Skip to main content
Glama
cryppadotta

Scryfall MCP Server

by cryppadotta

get_prices_by_id

Retrieve Magic: The Gathering card pricing data by Scryfall ID to access current market values including USD, foil, EUR, and tix prices.

Instructions

Retrieve price information for a card by its Scryfall ID. Returns JSON with usd, usd_foil, eur, tix, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesScryfall ID of the card

Implementation Reference

  • Handler function that fetches the full card by Scryfall ID from the API, extracts the prices object, and returns it as formatted JSON text. Handles errors and missing prices.
    async function handleGetPricesById(id: string) {
      const url = `https://api.scryfall.com/cards/${encodeURIComponent(id)}`;
      const response = await fetch(url);
      if (!response.ok) {
        return handleScryfallResponse(response);
      }
      const data = (await response.json()) as ScryfallCard;
    
      if (!data.prices) {
        return {
          content: [
            {
              type: "text",
              text: "No price information found for this card."
            }
          ],
          isError: false
        };
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data.prices, null, 2)
          }
        ],
        isError: false
      };
    }
  • Tool definition with name, description, and input schema (object with required 'id' string field).
    const GET_PRICES_BY_ID_TOOL: Tool = {
      name: "get_prices_by_id",
      description:
        "Retrieve price information for a card by its Scryfall ID. Returns JSON with usd, usd_foil, eur, tix, etc.",
      inputSchema: {
        type: "object",
        properties: {
          id: {
            type: "string",
            description: "Scryfall ID of the card"
          }
        },
        required: ["id"]
      }
    };
  • index.ts:186-194 (registration)
    Registration of the tool in the SCRYFALL_TOOLS array, which is returned by the listTools request 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:393-396 (registration)
    Dispatcher switch case in the callToolRequest handler that extracts the 'id' argument and invokes the handler function.
    case "get_prices_by_id": {
      const { id } = args as { id: string };
      return await handleGetPricesById(id);
    }
  • Shared helper function to process Scryfall API responses into MCP content format, handling errors and formatting successful JSON responses. Called by the handler on API errors.
    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 of behavioral disclosure. It mentions the return format ('Returns JSON with usd, usd_foil, eur, tix, etc.') which is helpful, but doesn't cover other aspects like error handling, rate limits, or authentication needs. The description adds some value but lacks comprehensive behavioral context.

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 two concise sentences with zero waste: the first states the purpose and input, the second specifies the output format. It's front-loaded with the core functionality and appropriately sized for a simple tool.

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

Completeness4/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 is reasonably complete: it covers what the tool does, the input requirement, and the output format. However, without annotations or output schema, it could benefit from more behavioral details like error cases or data freshness, slightly limiting completeness.

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%, with the single parameter 'id' fully documented in the schema as 'Scryfall ID of the card.' The description adds no additional parameter details beyond what the schema provides, so it meets the baseline of 3 for adequate but not enhanced parameter semantics.

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 price information') and resource ('for a card by its Scryfall ID'), distinguishing it from siblings like get_card_by_id (general card info) and get_prices_by_name (price by name instead of ID). The verb+resource combination is precise and unambiguous.

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

Usage Guidelines4/5

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

The description implies usage context by specifying 'by its Scryfall ID,' suggesting this tool should be used when you have the ID rather than the card name. However, it doesn't explicitly state when NOT to use it or name alternatives like get_prices_by_name, leaving some room for improvement in sibling differentiation.

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