Skip to main content
Glama

get_prices

Retrieve current market prices for Magic: The Gathering cards in USD, USD foil, EUR, and MTGO tickets via Scryfall. Ideal for checking card values, deck costs, or price comparisons.

Instructions

Look up current market prices for one or more Magic cards. Returns USD, USD Foil, EUR, and MTGO tix prices from Scryfall. Use this when a user asks about card prices, deck costs, or wants to compare card values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namesYesCard names to look up prices for (1-50)

Implementation Reference

  • The main handler for the get_prices tool. Iterates over card names from input, queries the database with exact match first then fuzzy LIKE fallback, and returns price data (USD, USD Foil, EUR, EUR Foil, MTGO tix) for each card.
    export function handler(db: Database.Database, params: GetPricesParams): GetPricesResult {
      const cards: CardPriceEntry[] = [];
    
      for (const name of params.names) {
        // 1. Exact match (case-insensitive)
        let card = db.prepare(
          'SELECT * FROM cards WHERE LOWER(name) = LOWER(?)'
        ).get(name) as CardRow | undefined;
    
        // 2. Fuzzy fallback via LIKE
        if (!card) {
          card = db.prepare(
            'SELECT * FROM cards WHERE LOWER(name) LIKE LOWER(?)'
          ).get(`%${name}%`) as CardRow | undefined;
        }
    
        if (!card) {
          cards.push({
            name,
            found: false,
            price_usd: null,
            price_usd_foil: null,
            price_eur: null,
            price_eur_foil: null,
            price_tix: null,
          });
        } else {
          cards.push({
            name: card.name,
            found: true,
            price_usd: card.price_usd,
            price_usd_foil: card.price_usd_foil,
            price_eur: card.price_eur,
            price_eur_foil: card.price_eur_foil,
            price_tix: card.price_tix,
          });
        }
      }
    
      return { cards };
    }
  • Input schema: accepts an array of 1-50 card name strings (validated with Zod).
    export const GetPricesInput = z.object({
      names: z.array(z.string()).min(1).max(50).describe('Card names to look up prices for (1-50)'),
    });
  • Output type: result containing an array of CardPriceEntry objects, each with found status and price fields.
    export interface GetPricesResult {
      cards: CardPriceEntry[];
    }
  • Individual card price entry type with five price fields (USD, USD Foil, EUR, EUR Foil, MTGO tix).
    export interface CardPriceEntry {
      name: string;
      found: boolean;
      price_usd: number | null;
      price_usd_foil: number | null;
      price_eur: number | null;
      price_eur_foil: number | null;
      price_tix: number | null;
    }
  • src/server.ts:253-265 (registration)
    Registers the 'get_prices' MCP tool on the server with its description, input schema, and handler invocation.
    server.tool(
      'get_prices',
      'Look up current market prices for one or more Magic cards. Returns USD, USD Foil, EUR, and MTGO tix prices from Scryfall. Use this when a user asks about card prices, deck costs, or wants to compare card values.',
      GetPricesInput.shape,
      async (params) => {
        try {
          const result = getPricesHandler(db, params);
          return { content: [{ type: 'text' as const, text: formatGetPrices(result) }] };
        } catch (err) {
          return { content: [{ type: 'text' as const, text: `Error getting prices: ${err instanceof Error ? err.message : String(err)}` }], isError: true };
        }
      },
    );
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must stand alone. It states the tool returns prices from Scryfall but does not disclose behavior for missing or misspelled names, rate limits, or any side effects. This is adequate for a simple lookup but lacks depth for full transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the action and key details, followed by usage guidance. No wasted words, highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description explains what the tool does, what it returns, and when to use it. With one parameter and no output schema, it provides enough context for an agent to invoke correctly, though it could mention error handling or return format for missing cards.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage for the single 'names' parameter. The description adds context about the currencies returned but does not explain parameter format or constraints beyond the schema. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool looks up current market prices for Magic cards, specifies the price types (USD, USD Foil, EUR, MTGO tix) and source (Scryfall). It distinguishes from sibling tools like get_card or check_legality which deal with card details or legality, not prices.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly tells when to use: 'Use this when a user asks about card prices, deck costs, or wants to compare card values.' Does not mention when not to use or provide alternative tools, but the context is clear given sibling names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/gregario/mtg-oracle'

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