Skip to main content
Glama
gregario

lorcana-oracle

browse_sets

Browse Disney Lorcana TCG sets to view metadata and cards. List all sets or specify a set code to see its contents.

Instructions

List all Disney Lorcana sets, or drill into a specific set to see its metadata and cards. Provide a set_code to see cards in that set.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
set_codeNoSet code to browse (e.g. "1", "2"). Omit to list all sets.

Implementation Reference

  • The async handler function for the 'browse_sets' tool, which handles either listing all sets or listing cards within a specific set.
    async (args) => {
      if (!args.set_code) {
        // List all sets
        const sets = listSets(db);
        if (sets.length === 0) {
          return {
            content: [{ type: 'text' as const, text: 'No sets found in the database.' }],
          };
        }
        const lines = sets.map(
          (s) =>
            `**${s.name}** (${s.code})\n  Type: ${s.type ?? '—'} | Cards: ${s.card_count} | Released: ${s.release_date ?? '—'}`,
        );
        return {
          content: [
            {
              type: 'text' as const,
              text: `Found ${sets.length} sets:\n\n${lines.join('\n\n')}`,
            },
          ],
        };
      }
    
      // Browse specific set
      const set = getSet(db, args.set_code);
      if (!set) {
        const allSets = listSets(db);
        const codes = allSets.map((s) => s.code).join(', ');
        return {
          content: [
            {
              type: 'text' as const,
              text: `Set "${args.set_code}" not found. Available set codes: ${codes}`,
            },
          ],
          isError: true,
        };
      }
    
      const { rows } = getCardsBySet(db, args.set_code, 1000, 0);
      const header = [
        `**${set.name}** (${set.code})`,
        `Type: ${set.type ?? '—'} | Cards: ${set.card_count} | Released: ${set.release_date ?? '—'}`,
        '',
        `Cards in set (${rows.length}):`,
      ].join('\n');
    
      const cardLines = rows.map(formatCardBrief);
    
      return {
        content: [
          {
            type: 'text' as const,
            text: header + '\n' + cardLines.join('\n'),
          },
        ],
      };
    },
  • The Zod input schema definition for the 'browse_sets' tool.
    inputSchema: {
      set_code: z.string().optional().describe('Set code to browse (e.g. "1", "2"). Omit to list all sets.'),
    },
  • The registration function 'registerBrowseSets' which registers the 'browse_sets' tool with the MCP server.
    export function registerBrowseSets(server: McpServer, db: Database.Database): void {
      server.registerTool(
        'browse_sets',
        {
          title: 'Browse Sets',
          description:
            'List all Disney Lorcana sets, or drill into a specific set to see its metadata and cards. Provide a set_code to see cards in that set.',
          inputSchema: {
            set_code: z.string().optional().describe('Set code to browse (e.g. "1", "2"). Omit to list all sets.'),
          },
        },
        async (args) => {
          if (!args.set_code) {
            // List all sets
            const sets = listSets(db);
            if (sets.length === 0) {
              return {
                content: [{ type: 'text' as const, text: 'No sets found in the database.' }],
              };
            }
            const lines = sets.map(
              (s) =>
                `**${s.name}** (${s.code})\n  Type: ${s.type ?? '—'} | Cards: ${s.card_count} | Released: ${s.release_date ?? '—'}`,
            );
            return {
              content: [
                {
                  type: 'text' as const,
                  text: `Found ${sets.length} sets:\n\n${lines.join('\n\n')}`,
                },
              ],
            };
          }
    
          // Browse specific set
          const set = getSet(db, args.set_code);
          if (!set) {
            const allSets = listSets(db);
            const codes = allSets.map((s) => s.code).join(', ');
            return {
              content: [
                {
                  type: 'text' as const,
                  text: `Set "${args.set_code}" not found. Available set codes: ${codes}`,
                },
              ],
              isError: true,
            };
          }
    
          const { rows } = getCardsBySet(db, args.set_code, 1000, 0);
          const header = [
            `**${set.name}** (${set.code})`,
            `Type: ${set.type ?? '—'} | Cards: ${set.card_count} | Released: ${set.release_date ?? '—'}`,
            '',
            `Cards in set (${rows.length}):`,
          ].join('\n');
    
          const cardLines = rows.map(formatCardBrief);
    
          return {
            content: [
              {
                type: 'text' as const,
                text: header + '\n' + cardLines.join('\n'),
              },
            ],
          };
        },
      );
    }

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

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