Skip to main content
Glama
gregario

lorcana-oracle

Search Cards

search_cards

Find Disney Lorcana cards by name, text, or filters like ink color, type, rarity, set, and cost. Get paginated results for deck building and gameplay.

Instructions

Search Disney Lorcana cards by name, rules text, or filters (ink color, type, rarity, set, cost range). Returns paginated results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoSearch by card name or rules text
inkNoFilter by ink color (e.g. Amber, Amethyst, Emerald, Ruby, Sapphire, Steel)
typeNoFilter by card type (e.g. Character, Song, Item, Action, Location)
rarityNoFilter by rarity (e.g. Common, Uncommon, Rare, Super Rare, Legendary, Enchanted)
setNoFilter by set code
cost_minNoMinimum ink cost (inclusive)
cost_maxNoMaximum ink cost (inclusive)
limitNoMax results to return (default 20)
cursorNoOffset for pagination

Implementation Reference

  • The actual handler function for 'search_cards' which maps MCP tool arguments to internal DB filters and executes the database search.
    async (args) => {
      const filters: SearchFilters = {
        query: args.query,
        color: args.ink,
        type: args.type,
        rarity: args.rarity,
        setCode: args.set,
        costMin: args.cost_min,
        costMax: args.cost_max,
        limit: args.limit,
        offset: args.cursor,
      };
    
      const { rows, total } = searchCards(db, filters);
    
      if (rows.length === 0) {
        return {
          content: [{ type: 'text' as const, text: 'No cards found matching your search criteria.' }],
        };
      }
    
      const offset = args.cursor ?? 0;
      const parts = rows.map(formatCard);
      const footer: string[] = [];
      footer.push(`\n---\nShowing ${offset + 1}–${offset + rows.length} of ${total} results.`);
      if (offset + rows.length < total) {
        footer.push(`Use cursor: ${offset + rows.length} to see more.`);
      }
    
      return {
        content: [
          { type: 'text' as const, text: parts.join('\n\n') + footer.join(' ') },
        ],
      };
    },
  • Registration of the 'search_cards' tool within the MCP server, including the input schema definition.
    server.registerTool(
      'search_cards',
      {
        title: 'Search Cards',
        description:
          'Search Disney Lorcana cards by name, rules text, or filters (ink color, type, rarity, set, cost range). Returns paginated results.',
        inputSchema: {
          query: z.string().optional().describe('Search by card name or rules text'),
          ink: z.string().optional().describe('Filter by ink color (e.g. Amber, Amethyst, Emerald, Ruby, Sapphire, Steel)'),
          type: z.string().optional().describe('Filter by card type (e.g. Character, Song, Item, Action, Location)'),
          rarity: z.string().optional().describe('Filter by rarity (e.g. Common, Uncommon, Rare, Super Rare, Legendary, Enchanted)'),
          set: z.string().optional().describe('Filter by set code'),
          cost_min: z.number().optional().describe('Minimum ink cost (inclusive)'),
          cost_max: z.number().optional().describe('Maximum ink cost (inclusive)'),
          limit: z.number().optional().default(20).describe('Max results to return (default 20)'),
          cursor: z.number().optional().describe('Offset for pagination'),
        },
      },
  • The core database function that performs the SQL queries for searching cards based on provided filters.
    export function searchCards(
      db: Database.Database,
      filters: SearchFilters,
    ): SearchResult {
      const conditions: string[] = [];
      const params: (string | number)[] = [];
    
      if (filters.query) {
        const ftsQuery = sanitizeFtsQuery(filters.query);
        if (ftsQuery.length > 0) {
          conditions.push(
            'c.id IN (SELECT rowid FROM cards_fts WHERE cards_fts MATCH ?)',
          );
          params.push(ftsQuery);
        }
      }
    
      if (filters.color) {
        conditions.push('LOWER(c.color) = LOWER(?)');
        params.push(filters.color);
      }
    
      if (filters.type) {
        conditions.push('LOWER(c.type) = LOWER(?)');
        params.push(filters.type);
      }
    
      if (filters.cost !== undefined) {
        const op = filters.costOp ?? 'eq';
        const sqlOp = op === 'lte' ? '<=' : op === 'gte' ? '>=' : '=';
        conditions.push(`c.cost ${sqlOp} ?`);
        params.push(filters.cost);
      }
    
      if (filters.costMin !== undefined) {
        conditions.push('c.cost >= ?');
        params.push(filters.costMin);
      }
    
      if (filters.costMax !== undefined) {
        conditions.push('c.cost <= ?');
        params.push(filters.costMax);
      }
    
      if (filters.rarity) {
        conditions.push('LOWER(c.rarity) = LOWER(?)');
        params.push(filters.rarity);
      }
    
      if (filters.setCode) {
        conditions.push('c.set_code = ?');
        params.push(filters.setCode);
      }
    
      if (filters.story) {
        conditions.push('LOWER(c.story) = LOWER(?)');
        params.push(filters.story);
      }
    
      if (filters.inkwell !== undefined) {
        conditions.push('c.inkwell = ?');
        params.push(filters.inkwell ? 1 : 0);
      }
    
      if (filters.hasKeyword) {
        conditions.push('c.keyword_abilities LIKE ?');
        params.push(`%${filters.hasKeyword}%`);
      }
    
      const where =
        conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
      const limit = filters.limit ?? 20;
      const offset = filters.offset ?? 0;
    
      const countRow = db
        .prepare(`SELECT COUNT(*) as count FROM cards c ${where}`)
        .get(...params) as { count: number };
    
      const rows = db
        .prepare(
          `SELECT c.* FROM cards c ${where} ORDER BY c.cost ASC, c.name ASC LIMIT ? OFFSET ?`,
        )
        .all(...params, limit, offset) as CardRow[];
    
      return { rows, total: countRow.count };
    }
Behavior3/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 mentions 'Returns paginated results' which is valuable behavioral information, but doesn't cover other important aspects like rate limits, authentication requirements, error conditions, or what happens with invalid parameters. The description adds some context but leaves significant 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 perfectly concise - a single sentence that efficiently communicates the tool's purpose, search capabilities, and pagination behavior. Every word earns its place with zero redundancy or unnecessary elaboration.

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

Completeness3/5

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

For a search tool with 9 parameters, 100% schema coverage, but no annotations or output schema, the description is adequate but incomplete. It covers the core functionality and pagination, but lacks information about response format, error handling, or performance characteristics that would help an agent use it effectively.

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 all 9 parameters thoroughly with descriptions and examples. The description mentions the same search criteria (name, rules text, filters) but doesn't add meaningful semantic context beyond what's in the schema. 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.

Purpose5/5

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

The description clearly states the specific action ('Search Disney Lorcana cards') and resources involved, with explicit search criteria (name, rules text, filters) and outcome (paginated results). It distinguishes from siblings like browse_sets or analyze_ink_curve by focusing on comprehensive card search rather than set browsing or analytical functions.

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

Usage Guidelines3/5

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

The description implies usage for searching cards with various filters, but doesn't explicitly state when to use this tool versus alternatives like browse_sets (for set overview) or character_versions (for specific character variants). No exclusion criteria or prerequisites are mentioned, leaving some ambiguity about optimal use cases.

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

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