Skip to main content
Glama

analyze_commander

Analyze legendary creatures as potential Commanders to identify color identity, strategies, archetypes, and recommended card categories for deck building.

Instructions

Analyze a legendary creature as a potential Commander. Returns color identity, suggested strategies, archetypes, and recommended card categories for building a deck around this commander. Use this when a user wants help building or evaluating a Commander deck.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesCommander card name to analyze

Implementation Reference

  • The implementation of the 'analyze_commander' tool handler, which queries the database for a legendary creature card, verifies it, and calculates strategies, archetypes, and recommended deck categories.
    export function handler(db: Database.Database, params: AnalyzeCommanderParams): AnalyzeCommanderResult {
      // 1. Look up the card
      let card = db.prepare(
        'SELECT * FROM cards WHERE LOWER(name) = LOWER(?)'
      ).get(params.name) as CardRow | undefined;
    
      if (!card) {
        card = db.prepare(
          'SELECT * FROM cards WHERE LOWER(name) LIKE LOWER(?)'
        ).get(`%${params.name}%`) as CardRow | undefined;
      }
    
      if (!card) {
        return {
          found: false,
          message: `No card found matching "${params.name}"`,
        };
      }
    
      // 2. Verify it's a legendary creature
      const typeLine = card.type_line ?? '';
      if (!typeLine.toLowerCase().includes('legendary') || !typeLine.toLowerCase().includes('creature')) {
        return {
          found: false,
          message: `"${card.name}" is not a legendary creature (type: ${typeLine}). Only legendary creatures can be commanders.`,
        };
      }
    
      // 3. Extract data
      const colorIdentity: string[] = card.color_identity
        ? JSON.parse(card.color_identity) as string[]
        : [];
      const keywords: string[] = card.keywords
        ? JSON.parse(card.keywords) as string[]
        : [];
    
      // 4. Check for Partner
      const hasPartner = keywords.some(k =>
        k.toLowerCase() === 'partner' ||
        k.toLowerCase().startsWith('partner with')
      ) || (card.oracle_text ?? '').toLowerCase().includes('partner');
    
      // 5. Match strategies & archetypes
      const strategies = matchStrategies(colorIdentity);
      const archetypes = matchArchetypes(card.oracle_text, keywords, colorIdentity);
      const categories = recommendCategories(card.oracle_text, keywords, card.type_line);
    
      const analysis: CommanderAnalysis = {
        name: card.name,
        color_identity: colorIdentity,
        type_line: typeLine,
        oracle_text: card.oracle_text,
        edhrec_rank: card.edhrec_rank,
        has_partner: hasPartner,
        suggested_strategies: strategies.map(s => ({
          id: s.id,
          name: s.name,
          description: s.description,
          power_brackets: [...s.powerBrackets],
          staple_cards: [...s.stapleCards],
          key_synergies: [...s.keySynergies],
        })),
        suggested_archetypes: archetypes.map(a => ({
          id: a.id,
          name: a.name,
          description: a.description,
          key_mechanics: [...a.keyMechanics],
        })),
        recommended_categories: categories,
      };
    
      return { found: true, analysis };
    }
  • The Zod input schema for the 'analyze_commander' tool.
    export const AnalyzeCommanderInput = z.object({
      name: z.string().describe('Commander card name to analyze'),
    });
  • src/server.ts:207-213 (registration)
    Registration of the 'analyze_commander' tool in the MCP server.
    'analyze_commander',
    'Analyze a legendary creature as a potential Commander. Returns color identity, suggested strategies, archetypes, and recommended card categories for building a deck around this commander. Use this when a user wants help building or evaluating a Commander deck.',
    AnalyzeCommanderInput.shape,
    async (params) => {
      try {
        const result = analyzeCommanderHandler(db, params);
        return { content: [{ type: 'text' as const, text: formatAnalyzeCommander(result) }] };
Behavior3/5

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

No annotations are provided, so the description carries full burden. It describes what the tool returns (color identity, strategies, archetypes, card categories) but doesn't disclose behavioral aspects like rate limits, error conditions, or whether it requires specific permissions. The description adds value but lacks operational transparency.

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?

Two sentences with zero waste. First sentence explains what the tool does and returns, second sentence provides usage guidance. Every element earns its place and the description is appropriately front-loaded with core functionality.

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?

For a single-parameter tool with no annotations and no output schema, the description provides good context about what the analysis includes and when to use it. However, it doesn't describe the format or structure of the returned analysis, which would be helpful given the lack of output schema.

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 the single parameter. The description doesn't add any parameter-specific information beyond what the schema provides (e.g., format expectations, examples, or edge cases). 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 tool's purpose with specific verbs ('analyze', 'returns') and resources ('legendary creature', 'Commander deck'), and distinguishes it from siblings by focusing on commander-specific analysis rather than general card lookup or deck analysis.

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

Usage Guidelines5/5

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

Explicitly states when to use the tool: 'when a user wants help building or evaluating a Commander deck.' This provides clear context and distinguishes it from sibling tools like analyze_deck or get_card that serve different purposes.

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