Skip to main content
Glama
gregario

onepiece-oracle

card_versions

Find all printings and alternate art variants of One Piece TCG cards by searching with card names or numbers.

Instructions

Show all printings/versions of a One Piece TCG card, including alternate art variants. Search by card name or card number.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
card_nameNoCard name to look up (e.g., "Monkey.D.Luffy")
card_numberNoCard number to look up (e.g., "OP01-001")

Implementation Reference

  • The implementation of the 'card_versions' tool handler, which processes the input, searches for cards by name or number, and formats the response.
        async ({ card_name, card_number }) => {
          if (!card_name && !card_number) {
            return {
              isError: true,
              content: [
                {
                  type: 'text' as const,
                  text: 'Provide either card_name or card_number to look up.',
                },
              ],
            };
          }
    
          let cards;
          if (card_number) {
            const card = getCardByNumber(card_number);
            if (!card) {
              return {
                isError: true,
                content: [
                  {
                    type: 'text' as const,
                    text: `Card "${card_number}" not found. Check the card number format (e.g., "OP01-001").`,
                  },
                ],
              };
            }
            // Find all versions with the same name
            cards = getCardsByName(card.card_name);
          } else {
            cards = getCardsByName(card_name!);
          }
    
          if (cards.length === 0) {
            return {
              isError: true,
              content: [
                {
                  type: 'text' as const,
                  text: `No cards found matching "${card_name || card_number}". Try search_cards for a broader search.`,
                },
              ],
            };
          }
    
          const name = cards[0].card_name;
          const regular = cards.filter((c) => !c.is_alternate_art);
          const altArt = cards.filter((c) => c.is_alternate_art);
    
          const lines = [
            `# ${name} — ${cards.length} version${cards.length !== 1 ? 's' : ''}`,
            '',
          ];
    
          if (regular.length > 0) {
            lines.push(`## Regular (${regular.length})`);
            lines.push('');
            lines.push(regular.map((c) => formatCard(c)).join('\n\n---\n\n'));
          }
    
          if (altArt.length > 0) {
            lines.push('');
            lines.push(`## Alternate Art (${altArt.length})`);
            lines.push('');
            lines.push(altArt.map((c) => formatCard(c)).join('\n\n---\n\n'));
          }
    
          return {
            content: [{ type: 'text' as const, text: lines.join('\n') }],
          };
        },
      );
    }
  • Input schema definition for the 'card_versions' tool using zod.
      inputSchema: {
        card_name: z.string().optional().describe('Card name to look up (e.g., "Monkey.D.Luffy")'),
        card_number: z.string().optional().describe('Card number to look up (e.g., "OP01-001")'),
      },
    },
  • Tool registration function for 'card_versions'.
    export function registerCardVersions(server: McpServer): void {
      server.registerTool(
        'card_versions',
        {
          description:
            'Show all printings/versions of a One Piece TCG card, including alternate art variants. Search by card name or card number.',
          inputSchema: {
            card_name: z.string().optional().describe('Card name to look up (e.g., "Monkey.D.Luffy")'),
            card_number: z.string().optional().describe('Card number to look up (e.g., "OP01-001")'),
          },
        },
        async ({ card_name, card_number }) => {
          if (!card_name && !card_number) {
            return {
              isError: true,
              content: [
                {
                  type: 'text' as const,
                  text: 'Provide either card_name or card_number to look up.',
                },
              ],
            };
          }
    
          let cards;
          if (card_number) {
            const card = getCardByNumber(card_number);
            if (!card) {
              return {
                isError: true,
                content: [
                  {
                    type: 'text' as const,
                    text: `Card "${card_number}" not found. Check the card number format (e.g., "OP01-001").`,
                  },
                ],
              };
            }
            // Find all versions with the same name
            cards = getCardsByName(card.card_name);
          } else {
            cards = getCardsByName(card_name!);
          }
    
          if (cards.length === 0) {
            return {
              isError: true,
              content: [
                {
                  type: 'text' as const,
                  text: `No cards found matching "${card_name || card_number}". Try search_cards for a broader search.`,
                },
              ],
            };
          }
    
          const name = cards[0].card_name;
          const regular = cards.filter((c) => !c.is_alternate_art);
          const altArt = cards.filter((c) => c.is_alternate_art);
    
          const lines = [
            `# ${name} — ${cards.length} version${cards.length !== 1 ? 's' : ''}`,
            '',
          ];
    
          if (regular.length > 0) {
            lines.push(`## Regular (${regular.length})`);
            lines.push('');
            lines.push(regular.map((c) => formatCard(c)).join('\n\n---\n\n'));
          }
    
          if (altArt.length > 0) {
            lines.push('');
            lines.push(`## Alternate Art (${altArt.length})`);
            lines.push('');
            lines.push(altArt.map((c) => formatCard(c)).join('\n\n---\n\n'));
          }
    
          return {
            content: [{ type: 'text' as const, text: lines.join('\n') }],
          };
        },
      );
    }

Tool Definition Quality

Score is being calculated. Check back soon.

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/onepiece-oracle'

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