Skip to main content
Glama

get_card

Retrieve Magic: The Gathering card data by Scryfall UUID or card name using exact or fuzzy matching.

Instructions

Get a single card by Scryfall UUID or by name (exact/fuzzy).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNo
nameNo
fuzzyNoIf true, uses fuzzy name match

Implementation Reference

  • Handler function that executes the 'get_card' tool: fetches card data from Scryfall by ID (exact) or name (exact/fuzzy).
    async ({ id, name, fuzzy }: { id?: string; name?: string; fuzzy?: boolean }): Promise<ToolResult> => { const data: unknown = id ? await Scryfall.getCardById(id) : await Scryfall.getCardNamed(name as string, Boolean(fuzzy)); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] } as any; }
  • Input schema (Zod) defining parameters for the 'get_card' tool: optional id (UUID), name, and fuzzy flag.
    const getCardParamsShape = { id: z.string().uuid().optional(), name: z.string().optional(), fuzzy: z.boolean().optional().describe("If true, uses fuzzy name match") } as const;
  • Registration of the 'get_card' tool with MCP server, including description, schema, and handler.
    server.registerTool( "get_card", { description: "Get a single card by Scryfall UUID or by name (exact/fuzzy).", inputSchema: getCardParamsShape }, async ({ id, name, fuzzy }: { id?: string; name?: string; fuzzy?: boolean }): Promise<ToolResult> => { const data: unknown = id ? await Scryfall.getCardById(id) : await Scryfall.getCardNamed(name as string, Boolean(fuzzy)); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] } as any; } );
  • Scryfall API helper: fetches card details by encoded ID.
    getCardById: (id: string) => getJson(`/cards/${encodeURIComponent(id)}`),
  • Scryfall API helper: fetches card by name, with optional fuzzy matching.
    getCardNamed: (name: string, fuzzy = false) => getJson("/cards/named", fuzzy ? { fuzzy: name } : { exact: 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/latte-chan/scryfall-connector'

If you have feedback or need assistance with the MCP directory API, please join our Discord server