Skip to main content
Glama

search_cards

Search Magic: The Gathering cards using Scryfall's full-text syntax to find specific cards based on type, cost, color, and other attributes.

Instructions

Search cards using Scryfall's powerful full-text syntax.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dirNo
include_extrasNo
include_multilingualNo
include_variationsNo
orderNo
pageNo
qYesScryfall search query, e.g., 't:creature cmc<=3'
uniqueNo

Implementation Reference

  • Handler function that executes the tool logic: calls Scryfall.searchCards with the input parameters and returns the raw JSON response formatted as text content.
    async (params: SearchParams): Promise<ToolResult> => { const data: unknown = await Scryfall.searchCards(params); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] } as any; }
  • Zod input schema definition for the search_cards tool, defining parameters like query, ordering, pagination, etc.
    const searchParamsShape = { q: z.string().describe("Scryfall search query, e.g., 't:creature cmc<=3'"), unique: z.enum(["cards", "art", "prints"]).optional(), order: z .enum([ "name", "set", "released", "rarity", "color", "usd", "tix", "eur", "cmc", "power", "toughness", "edhrec", "penny", "artist", "review" ]) .optional(), dir: z.enum(["auto", "asc", "desc"]).optional(), page: z.number().int().min(1).optional(), include_extras: z.boolean().optional(), include_multilingual: z.boolean().optional(), include_variations: z.boolean().optional() } as const;
  • Registration of the 'search_cards' tool on the MCP server, specifying name, description, input schema, and handler function.
    server.registerTool( "search_cards", { description: "Search cards using Scryfall's powerful full-text syntax.", inputSchema: searchParamsShape }, async (params: SearchParams): Promise<ToolResult> => { const data: unknown = await Scryfall.searchCards(params); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] } as any; } );
  • Supporting utility function Scryfall.searchCards that makes the HTTP request to Scryfall API's /cards/search endpoint.
    searchCards: (opts: SearchParams) => getJson("/cards/search", opts),

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