Skip to main content
Glama
jlgrimes

Pokemon TCG Card Search MCP

by jlgrimes

pokemon-card-price

Check the current market price of a Pokémon card by entering its name and set details using this tool from the Pokémon TCG Card Search MCP server.

Instructions

Look up the current market price for a Pokemon card

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesCRITICAL: Never infer or guess values. Never provide default values. Never make assumptions about what the user might want. Never try to be systematic or methodical. Never try to find "specific examples". Just query exactly what was asked for, nothing more and nothing less. CRITICAL: Query exactly what was asked for. Do not try to be systematic. Do not try to find specific examples. Do not try to be methodical. Just make the exact query requested. IMPORTANT: For hyphenated names like "chien-pao", you MUST preserve the hyphen exactly as it appears. For example, "chien-pao ex" should have name "chien-pao" (with the hyphen) and subtypes ["EX"]. Never remove or modify hyphens in the name. Use * for wildcard matching (e.g., "char*" to match all cards starting with "char", or "char*der" to match cards starting with "char" and ending with "der"). Use ! for exact matching (e.g., "!value" to match only exact value). IMPORTANT: If no name is explicitly provided in the query, do not include a name field at all.
setNoCRITICAL: Never infer or guess values. Never provide default values. Never make assumptions about what the user might want. Never try to be systematic or methodical. Never try to find "specific examples". Just query exactly what was asked for, nothing more and nothing less. The set information for this card. Use dot notation (.) to search nested fields (e.g., "set.id:sm1" for set ID, "attacks.name:Spelunk" for attack names). For example, "set.id:sm1" to find cards from a specific set. If no set information is explicitly mentioned, omit this field entirely.

Implementation Reference

  • Handler function that constructs a search query for the given card name and optional set, fetches the first matching card using ptcg_search, and returns its TCGPlayer and Cardmarket price information.
    async ({ name, set }) => {
      let query = buildQuery(
        name,
        undefined,
        undefined,
        undefined,
        undefined,
        undefined,
        undefined,
        undefined,
        undefined,
        undefined,
        set,
        undefined,
        undefined
      );
      const result = await ptcg_search(query);
    
      if (!result.data.length) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                error: 'No cards found matching the criteria',
              }),
            },
          ],
        };
      }
    
      const card = result.data[0];
      const priceInfo = {
        name: card.name,
        set: card.set.name,
        tcgplayer: card.tcgplayer
          ? {
              url: card.tcgplayer.url,
              updatedAt: card.tcgplayer.updatedAt,
              prices: card.tcgplayer.prices,
            }
          : null,
        cardmarket: card.cardmarket
          ? {
              url: card.cardmarket.url,
              updatedAt: card.cardmarket.updatedAt,
              prices: card.cardmarket.prices,
            }
          : null,
      };
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(priceInfo),
          },
        ],
      };
    }
  • Zod input schema defining required 'name' (string) and optional 'set' object (with name and series strings) for the pokemon-card-price tool.
    {
      name: z.string().describe(FIELD_DESCRIPTIONS_SPECIFIC.NAME),
      set: z
        .object({
          name: z.string(),
          series: z.string(),
        })
        .optional()
        .describe(FIELD_DESCRIPTIONS_SPECIFIC.SET),
    },
  • index.ts:346-419 (registration)
    Registration of the 'pokemon-card-price' tool on the MCP server, specifying name, description, input schema, and handler function.
    server.tool(
      'pokemon-card-price',
      'Look up the current market price for a Pokemon card',
      {
        name: z.string().describe(FIELD_DESCRIPTIONS_SPECIFIC.NAME),
        set: z
          .object({
            name: z.string(),
            series: z.string(),
          })
          .optional()
          .describe(FIELD_DESCRIPTIONS_SPECIFIC.SET),
      },
      async ({ name, set }) => {
        let query = buildQuery(
          name,
          undefined,
          undefined,
          undefined,
          undefined,
          undefined,
          undefined,
          undefined,
          undefined,
          undefined,
          set,
          undefined,
          undefined
        );
        const result = await ptcg_search(query);
    
        if (!result.data.length) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  error: 'No cards found matching the criteria',
                }),
              },
            ],
          };
        }
    
        const card = result.data[0];
        const priceInfo = {
          name: card.name,
          set: card.set.name,
          tcgplayer: card.tcgplayer
            ? {
                url: card.tcgplayer.url,
                updatedAt: card.tcgplayer.updatedAt,
                prices: card.tcgplayer.prices,
              }
            : null,
          cardmarket: card.cardmarket
            ? {
                url: card.cardmarket.url,
                updatedAt: card.cardmarket.updatedAt,
                prices: card.cardmarket.prices,
              }
            : null,
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(priceInfo),
            },
          ],
        };
      }
    );
  • Helper function that performs the actual API search to the Pokemon TCG API using the constructed query.
    async function ptcg_search(query: string): Promise<PtcgResponse> {
      const response = await fetch(
        `https://api.pokemontcg.io/v2/cards?q=${encodeURIComponent(query)}`
      );
      return response.json() as Promise<PtcgResponse>;
    }
  • Helper function to construct the search query string from input parameters, shared with other tools.
    function buildQuery(
      name?: string,
      subtypes?: string[],
      legalities?:
        | {
            standard?: 'legal' | 'banned';
            expanded?: 'legal' | 'banned';
            unlimited?: 'legal' | 'banned';
          }
        | string,
      hp?: string,
      types?: string[],
      evolvesTo?: string[],
      convertedRetreatCost?: number,
      nationalPokedexNumbers?: string,
      page?: number | string,
      pageSize?: number | string,
      set?: { id?: string; name?: string; series?: string } | string,
      attacks?:
        | Array<{ name?: string; cost?: string[]; damage?: string; text?: string }>
        | string,
      weaknesses?: Array<{ type?: string; value?: string }> | string,
      regulationMark?: string
    ): string {
      const parts: string[] = [];
    
      // Handle name with special cases
      if (name) {
        if (name.startsWith('!') || name.includes('*')) {
          parts.push(`name:${name}`);
        } else {
          parts.push(`name:"${name}"`);
        }
      }
    
      // Generic filter handler for arrays
      function addFilter(
        values: string[] | undefined,
        field: string,
        negative = false
      ) {
        if (!values?.length) return;
    
        const query = values
          .map(value => {
            if (value.includes('.')) return value;
            if (value.startsWith('!')) return `${field}:${value}`;
            if (negative) return `-${field}:${value}`;
            return `${field}:${value}`;
          })
          .join(' OR ');
    
        parts.push(values.length === 1 ? query : `(${query})`);
      }
    
      // Generic nested filter handler
      function addNestedFilter(value: string | object | undefined, field: string) {
        if (!value) return;
    
        if (typeof value === 'string') {
          parts.push(value.includes('.') ? value : `${field}:${value}`);
        } else {
          Object.entries(value).forEach(([key, val]) => {
            if (val !== undefined) {
              parts.push(`${field}.${key}:${val}`);
            }
          });
        }
      }
    
      // Generic range filter handler
      function addRangeFilter(value: string | number | undefined, field: string) {
        if (!value) return;
    
        const strValue = String(value);
        if (
          strValue.startsWith('[') ||
          strValue.startsWith('{') ||
          strValue.startsWith('!')
        ) {
          parts.push(`${field}:${strValue}`);
        } else {
          parts.push(`${field}:${value}`);
        }
      }
    
      // Add all filters
      addFilter(subtypes, 'subtypes');
      addNestedFilter(legalities, 'legalities');
      addFilter(types, 'types');
      addFilter(evolvesTo, 'evolvesTo');
    
      addRangeFilter(hp, 'hp');
      addRangeFilter(convertedRetreatCost, 'convertedRetreatCost');
      addRangeFilter(nationalPokedexNumbers, 'nationalPokedexNumbers');
      addRangeFilter(page, 'page');
      addRangeFilter(pageSize, 'pageSize');
    
      addNestedFilter(set, 'set');
      addNestedFilter(attacks, 'attacks');
      addNestedFilter(weaknesses, 'weaknesses');
    
      // Add regulation mark filter
      if (regulationMark) {
        parts.push(`regulationMark:${regulationMark}`);
      }
    
      return parts.join(' ');
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool looks up 'current market price' but doesn't specify data sources, freshness, accuracy, rate limits, authentication needs, or error conditions. For a price lookup tool with zero annotation coverage, this leaves significant behavioral gaps.

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 a single, efficient sentence that states the core functionality without unnecessary words. It's appropriately sized for a simple lookup tool and front-loads the essential information.

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

Completeness2/5

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

For a price lookup tool with no annotations and no output schema, the description is insufficient. It doesn't explain what format the price data returns (single value, range, historical data), currency, confidence metrics, or typical response structure. The agent has minimal context about what to expect from this tool.

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 documents both parameters thoroughly. The description doesn't add any parameter semantics beyond what's in the schema - it doesn't explain how 'name' and 'set' parameters affect price lookup results or provide usage examples. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the verb ('look up') and resource ('current market price for a Pokemon card'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from the sibling tool 'pokemon-card-search', which likely has overlapping functionality for searching cards rather than specifically checking prices.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus the sibling 'pokemon-card-search' tool, nor does it mention any prerequisites, constraints, or alternative scenarios. The agent must infer usage based solely on the tool name and description without explicit direction.

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

Related 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/jlgrimes/ptcg-mcp'

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