get_prices_by_name
Retrieve Magic: The Gathering card pricing details by exact name using JSON output, including USD, EUR, and foil values, through the Scryfall MCP Server.
Instructions
Retrieve price information for a card by its exact name. Returns JSON with usd, usd_foil, eur, tix, etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Exact card name |
Implementation Reference
- index.ts:312-343 (handler)The handler function that performs the tool logic: fetches the card by exact name from Scryfall API, extracts the prices object, and returns it as JSON text.async function handleGetPricesByName(name: string) { const url = `https://api.scryfall.com/cards/named?exact=${encodeURIComponent( name )}`; const response = await fetch(url); if (!response.ok) { return handleScryfallResponse(response); } const data = (await response.json()) as ScryfallCard; if (!data.prices) { return { content: [ { type: "text", text: "No price information found for this card." } ], isError: false }; } return { content: [ { type: "text", text: JSON.stringify(data.prices, null, 2) } ], isError: false }; }
- index.ts:169-183 (schema)The Tool object defining the schema, including inputSchema with the 'name' parameter.const GET_PRICES_BY_NAME_TOOL: Tool = { name: "get_prices_by_name", description: "Retrieve price information for a card by its exact name. Returns JSON with usd, usd_foil, eur, tix, etc.", inputSchema: { type: "object", properties: { name: { type: "string", description: "Exact card name" } }, required: ["name"] } };
- index.ts:186-194 (registration)Registration of the tool in the SCRYFALL_TOOLS array, which is returned in response 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;
- index.ts:397-400 (registration)Dispatch case in the CallToolRequestHandler switch statement that routes calls to the handler function.case "get_prices_by_name": { const { name } = args as { name: string }; return await handleGetPricesByName(name); }