Skip to main content
Glama
cryppadotta

Scryfall MCP Server

by cryppadotta

random_card

Retrieve a random Magic: The Gathering card from Scryfall's database. Get JSON data with card details, rulings, and pricing information for gameplay or collection purposes.

Instructions

Retrieve a random Magic card from Scryfall. Returns JSON data for that random card.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the random_card tool, which fetches a random card from the Scryfall API endpoint and processes the response using handleScryfallResponse.
    async function handleRandomCard() { const url = "https://api.scryfall.com/cards/random"; const response = await fetch(url); return handleScryfallResponse(response); }
  • Tool schema definition for random_card, including name, description, and inputSchema with no required parameters.
    const RANDOM_CARD_TOOL: Tool = { name: "random_card", description: "Retrieve a random Magic card from Scryfall. Returns JSON data for that random card.", inputSchema: { type: "object", properties: {}, required: [] } };
  • index.ts:186-194 (registration)
    Registration of the random_card tool (as RANDOM_CARD_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:386-388 (registration)
    Routing/registration in the CallToolRequestSchema switch statement that invokes the random_card handler.
    case "random_card": { return await handleRandomCard(); }

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