Skip to main content
Glama

find_combos

Search for infinite combos and synergistic card combinations from Commander Spellbook by card name, names, or color identity. Returns combo steps, prerequisites, and results.

Instructions

Find known infinite combos and synergistic card combinations from Commander Spellbook. Use this when a user asks about combos involving specific cards, combos in specific colors, or wants to find win conditions. Returns combo steps, prerequisites, and results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
card_nameNoSingle card name to search combos for
card_namesNoMultiple card names to search combos for
color_identityNoFilter combos within this color identity (e.g. ["W","U","B"])
limitNoMax results (default 20, max 50)

Implementation Reference

  • Main handler function that queries the database for combos based on card names and/or color identity filters.
    export function handler(db: Database.Database, params: FindCombosParams): FindCombosResult {
      const limit = params.limit ?? 20;
    
      // Collect all card names to search for
      const searchNames: string[] = [];
      if (params.card_name) searchNames.push(params.card_name);
      if (params.card_names) searchNames.push(...params.card_names);
    
      if (searchNames.length === 0 && !params.color_identity) {
        return { combos: [], total: 0 };
      }
    
      // Build query
      let sql = 'SELECT * FROM combos';
      const conditions: string[] = [];
      const bindings: unknown[] = [];
    
      // Card name filter: search in the JSON cards array
      if (searchNames.length > 0) {
        const nameConditions = searchNames.map(() => 'LOWER(cards) LIKE LOWER(?)');
        conditions.push(`(${nameConditions.join(' AND ')})`);
        for (const name of searchNames) {
          bindings.push(`%${name}%`);
        }
      }
    
      if (conditions.length > 0) {
        sql += ' WHERE ' + conditions.join(' AND ');
      }
    
      sql += ' ORDER BY popularity DESC LIMIT ?';
      // Fetch more than limit if we need to post-filter by color identity
      const fetchLimit = params.color_identity ? limit * 5 : limit;
      bindings.push(fetchLimit);
    
      const rows = db.prepare(sql).all(...bindings) as ComboRow[];
    
      // Post-filter by color identity constraint
      let filtered = rows;
      if (params.color_identity) {
        filtered = rows.filter(row => {
          const comboColors: string[] = row.color_identity
            ? JSON.parse(row.color_identity) as string[]
            : [];
          return fitsWithinIdentity(comboColors, params.color_identity!);
        });
      }
    
      // Apply limit after filtering
      const limited = filtered.slice(0, limit);
    
      const combos: ComboResult[] = limited.map(row => ({
        id: row.id,
        cards: JSON.parse(row.cards) as string[],
        color_identity: row.color_identity ? JSON.parse(row.color_identity) as string[] : [],
        prerequisites: row.prerequisites,
        steps: row.steps,
        results: row.results,
        popularity: row.popularity,
      }));
    
      return { combos, total: combos.length };
    }
  • Input schema (Zod) defining parameters: card_name, card_names, color_identity, and limit.
    export const FindCombosInput = z.object({
      card_name: z.string().optional().describe('Single card name to search combos for'),
      card_names: z.array(z.string()).optional().describe('Multiple card names to search combos for'),
      color_identity: z.array(z.string()).optional().describe('Filter combos within this color identity (e.g. ["W","U","B"])'),
      limit: z.number().min(1).max(50).optional().describe('Max results (default 20, max 50)'),
    });
  • Output type FindCombosResult containing an array of ComboResult objects and total count.
    export interface FindCombosResult {
      combos: ComboResult[];
      total: number;
    }
  • src/server.ts:209-220 (registration)
    Tool registration with the MCP server: binds the 'find_combos' tool name to FindCombosInput schema and the handler.
    server.tool(
      'find_combos',
      'Find known infinite combos and synergistic card combinations from Commander Spellbook. Use this when a user asks about combos involving specific cards, combos in specific colors, or wants to find win conditions. Returns combo steps, prerequisites, and results.',
      FindCombosInput.shape,
      async (params) => {
        try {
          const result = findCombosHandler(db, params);
          return { content: [{ type: 'text' as const, text: formatFindCombos(result) }] };
        } catch (err) {
          return { content: [{ type: 'text' as const, text: `Error finding combos: ${err instanceof Error ? err.message : String(err)}` }], isError: true };
        }
      },
  • Formatting helper that renders FindCombosResult into a human-readable string for the response.
    export function formatFindCombos(result: FindCombosResult): string {
      if (result.combos.length === 0) {
        return 'No combos found matching your criteria.';
      }
    
      const lines: string[] = [`Found ${result.total} combo(s):\n`];
    
      for (const combo of result.combos) {
        const colorPart = combo.color_identity.length > 0 ? ` [${combo.color_identity.join('')}]` : '';
        lines.push(`## ${combo.cards.join(' + ')}${colorPart}`);
    
        if (combo.prerequisites) {
          lines.push(`**Prerequisites:** ${combo.prerequisites}`);
        }
        if (combo.steps) {
          lines.push(`**Steps:** ${combo.steps}`);
        }
        if (combo.results) {
          lines.push(`**Result:** ${combo.results}`);
        }
        if (combo.popularity) {
          lines.push(`Popularity: ${combo.popularity}`);
        }
        lines.push('');
      }
    
      return lines.join('\n').trimEnd();
    }
Behavior3/5

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

No annotations are provided, so the description must cover behavioral traits. It states the output: 'Returns combo steps, prerequisites, and results,' which adds transparency about return format. However, it does not disclose whether the operation is read-only, any authentication needs, rate limits, or potential side effects. Without annotations, more detail would be beneficial.

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 consists of three concise sentences, each earning its place: the first states the core function, the second provides usage context, and the third describes the return value. No unnecessary words, front-loaded with the most important information.

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 parameter count (4) and full schema coverage, the description provides sufficient context for usage. It lacks mention of search behavior (e.g., exact match vs fuzzy) and does not specify if the tool is read-only, but the simplicity of the tool (no required params, no nested objects) means the description covers the essentials. The absence of an output schema is mitigated by the explicit listing of return components.

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?

The input schema has 100% description coverage for all four parameters, so the schema already explains each parameter's meaning. The description adds no additional semantic value beyond what the schema provides, thus the baseline score of 3 is appropriate.

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 finds 'known infinite combos and synergistic card combinations from Commander Spellbook,' using a specific verb ('Find') and resource ('combos'). It also lists usage scenarios (combos involving specific cards, colors, or win conditions) that distinguish it from siblings like 'find_synergies' which likely serve a different purpose.

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

Usage Guidelines4/5

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

The description explicitly states when to use: 'when a user asks about combos involving specific cards, combos in specific colors, or wants to find win conditions.' While it does not mention alternatives or when not to use, the context of sibling tools is available externally, making the guidance clear enough for an AI agent to decide.

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