Skip to main content
Glama
cryppadotta

Scryfall MCP Server

by cryppadotta

random_card

Retrieve a random Magic: The Gathering card with JSON data using the Scryfall API. Simplify access to card details for integration or exploration 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 handler function that implements the random_card tool by fetching a random card from the Scryfall API endpoint and returning the processed response.
    async function handleRandomCard() { const url = "https://api.scryfall.com/cards/random"; const response = await fetch(url); return handleScryfallResponse(response); }
  • The schema definition for the random_card tool, specifying name, description, and empty input schema (no parameters required).
    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 (RANDOM_CARD_TOOL) in the array of all available tools, 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)
    Dispatch/registration of the random_card tool in the switch statement of the CallToolRequestHandler, routing to the handleRandomCard function.
    case "random_card": { return await handleRandomCard(); }

Other Tools

Related 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