Skip to main content
Glama
cryppadotta

Scryfall MCP Server

by cryppadotta

get_card_by_name

Retrieve Magic: The Gathering card data by exact English name. Returns JSON with card details, rulings, and pricing information from Scryfall.

Instructions

Retrieve a card by its exact English name, e.g. 'Black Lotus'. Returns the card data in JSON. If multiple cards share that exact name, Scryfall returns one (usually the most relevant printing).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesExact name of the card, e.g. 'Lightning Bolt'

Implementation Reference

  • The main handler function that performs the HTTP fetch to Scryfall API for the exact card name and processes the response.
    async function handleGetCardByName(name: string) { // Tilde in URL means 'exact' mode for the card name const url = `https://api.scryfall.com/cards/named?exact=${encodeURIComponent( name )}`; const response = await fetch(url); return handleScryfallResponse(response); }
  • Defines the tool schema including name, description, and input validation schema.
    const GET_CARD_BY_NAME_TOOL: Tool = { name: "get_card_by_name", description: "Retrieve a card by its exact English name, e.g. 'Black Lotus'. Returns the card data in JSON. " + "If multiple cards share that exact name, Scryfall returns one (usually the most relevant printing).", inputSchema: { type: "object", properties: { name: { type: "string", description: "Exact name of the card, e.g. 'Lightning Bolt'" } }, required: ["name"] } };
  • index.ts:186-194 (registration)
    Registers the get_card_by_name tool by including it in the array of tools served to listTools requests.
    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;
  • Switch case in the main CallToolRequestSchema handler that routes calls to the specific get_card_by_name handler.
    case "get_card_by_name": { const { name } = args as { name: string }; return await handleGetCardByName(name); }

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