Skip to main content
Glama

get_prices

Retrieve current market prices for Magic: The Gathering cards in USD, EUR, and MTGO tix to evaluate card values, calculate deck costs, and compare pricing across formats.

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 logic for retrieving prices from the database for a list of card names.
    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 };
    }
  • Zod schema defining the input validation for 'get_prices'.
    export const GetPricesInput = z.object({
      names: z.array(z.string()).min(1).max(50).describe('Card names to look up prices for (1-50)'),
    });
  • src/server.ts:264-275 (registration)
    Tool registration in the MCP server for 'get_prices'.
    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?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the action ('look up current market prices') and data source ('from Scryfall'), but doesn't mention rate limits, authentication requirements, error conditions, or response format details. It provides basic operational context but lacks comprehensive behavioral traits.

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?

The description is perfectly concise with two sentences that each earn their place. The first sentence explains what the tool does and what it returns. The second sentence provides clear usage guidelines. There's zero wasted text and the information is front-loaded appropriately.

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?

Given the tool's moderate complexity (single parameter, no output schema, no annotations), the description is reasonably complete. It explains the purpose, usage context, and data source. However, without an output schema, it could benefit from more detail about the return structure. The description compensates well for the lack of annotations but doesn't fully address the missing output schema.

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?

Schema description coverage is 100%, so the schema already fully documents the single parameter. The description doesn't add any parameter-specific information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in description.

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's purpose with specific verbs ('look up', 'returns') and resources ('market prices for Magic cards', 'USD, USD Foil, EUR, and MTGO tix prices from Scryfall'). It distinguishes this from siblings by focusing specifically on price lookup rather than card analysis, legality checking, or searching.

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool: 'when a user asks about card prices, deck costs, or wants to compare card values.' This provides clear context for usage and differentiates it from siblings that handle different types of card queries like analysis, legality, or searching.

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