Skip to main content
Glama
bmurdock

Scryfall MCP Server

by bmurdock

validate_brawl_commander

Check if a Magic: The Gathering card is valid as a commander in Brawl or Standard Brawl formats using Scryfall MCP Server integration.

Instructions

Validate if a card can be a legal commander in Brawl or Standard Brawl formats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
card_identifierYesCard name, set code+collector number, or Scryfall ID to validate
formatYesBrawl format to validate for (brawl = Historic Brawl, standardbrawl = Standard Brawl)

Implementation Reference

  • The main execute method that handles tool invocation: validates inputs, fetches card data from Scryfall, performs commander validation, formats detailed response with eligibility checks and deck constraints, handles various errors.
    async execute(args: unknown) {
      try {
        // Validate parameters
        const params = this.validateParams(args);
    
        // Validate card identifier format
        validateCardIdentifier(params.card_identifier);
    
        // Fetch card data
        const card = await this.scryfallClient.getCard({ identifier: params.card_identifier });
        const formattedCard = formatCard(card);
    
        // Validate commander eligibility
        const validation = this.validateCommander(formattedCard, params.format);
    
        // Format response
        let responseText = `**Brawl Commander Validation: ${formattedCard.name}**\n\n`;
        responseText += `**Format:** ${params.format === 'brawl' ? 'Historic Brawl (100 cards)' : 'Standard Brawl (60 cards)'}\n`;
        responseText += `**Card Type:** ${formattedCard.type_line}\n`;
        responseText += `**Color Identity:** ${formattedCard.color_identity?.join('') || 'Colorless'}\n`;
        responseText += `**Arena Availability:** ${validation.arenaAvailable ? '✅ Available' : '❌ Not Available'}\n`;
        responseText += `**Format Legality:** ${validation.formatLegal ? '✅ Legal' : '❌ Not Legal'}\n`;
        responseText += `**Commander Eligible:** ${validation.commanderEligible ? '✅ Yes' : '❌ No'}\n\n`;
    
        if (validation.isValid) {
          responseText += `✅ **VALID COMMANDER**\n\n`;
          responseText += `${formattedCard.name} can be used as a commander in ${params.format === 'brawl' ? 'Historic Brawl' : 'Standard Brawl'}.\n\n`;
          responseText += `**Deck Building Constraints:**\n`;
          responseText += `- Deck size: ${params.format === 'brawl' ? '100' : '60'} cards (including commander)\n`;
          responseText += `- Color identity: ${formattedCard.color_identity?.join('') || 'Colorless'} only\n`;
          responseText += `- Card pool: ${params.format === 'brawl' ? 'Historic-legal' : 'Standard-legal'} cards\n`;
          responseText += `- Platform: Arena only\n`;
          responseText += `- Singleton: No duplicates except basic lands\n`;
        } else {
          responseText += `❌ **INVALID COMMANDER**\n\n`;
          responseText += `**Issues Found:**\n`;
          validation.issues.forEach(issue => {
            responseText += `- ${issue}\n`;
          });
        }
    
        return {
          content: [
            {
              type: 'text',
              text: responseText
            }
          ]
        };
    
      } catch (error) {
        // Handle validation errors
        if (error instanceof ValidationError) {
          return {
            content: [
              {
                type: 'text',
                text: `Validation error: ${error.message}`
              }
            ],
            isError: true
          };
        }
    
        // Handle API errors
        if (error instanceof ScryfallAPIError) {
          let errorMessage = `Scryfall API error: ${error.message}`;
          
          if (error.status === 404) {
            errorMessage = `Card not found: "${(args as any)?.card_identifier || 'unknown'}". Please check the card name or identifier.`;
          }
    
          return {
            content: [
              {
                type: 'text',
                text: errorMessage
              }
            ],
            isError: true
          };
        }
    
        // Generic error handling
        return {
          content: [
            {
              type: 'text',
              text: `Unexpected error: ${error instanceof Error ? error.message : 'Unknown error occurred'}`
            }
          ],
          isError: true
        };
      }
    }
  • Input schema defining required parameters: card_identifier (string) and format (enum ['brawl', 'standardbrawl']).
    readonly inputSchema = {
      type: 'object' as const,
      properties: {
        card_identifier: {
          type: 'string',
          description: 'Card name, set code+collector number, or Scryfall ID to validate'
        },
        format: {
          type: 'string',
          enum: ['brawl', 'standardbrawl'],
          description: 'Brawl format to validate for (brawl = Historic Brawl, standardbrawl = Standard Brawl)'
        }
      },
      required: ['card_identifier', 'format']
    };
  • src/server.ts:76-76 (registration)
    Tool registration in the MCP server's tools Map, instantiating ValidateBrawlCommanderTool with ScryfallClient.
    this.tools.set("validate_brawl_commander", new ValidateBrawlCommanderTool(this.scryfallClient));
  • Core validation helper: checks if card is legendary creature/planeswalker, format-legal, Arena-available; returns validation result with issues list.
    private validateCommander(card: any, format: 'brawl' | 'standardbrawl'): {
      isValid: boolean;
      commanderEligible: boolean;
      formatLegal: boolean;
      arenaAvailable: boolean;
      issues: string[];
    } {
      const issues: string[] = [];
      let commanderEligible = false;
      let formatLegal = false;
      let arenaAvailable = false;
    
      // Check if card is legendary
      const isLegendary = card.type_line?.toLowerCase().includes('legendary') || false;
      
      // Check if card is a creature or planeswalker
      const isCreature = card.type_line?.toLowerCase().includes('creature') || false;
      const isPlaneswalker = card.type_line?.toLowerCase().includes('planeswalker') || false;
      
      commanderEligible = isLegendary && (isCreature || isPlaneswalker);
      
      if (!isLegendary) {
        issues.push('Card must be legendary');
      }
      if (!isCreature && !isPlaneswalker) {
        issues.push('Card must be a creature or planeswalker');
      }
    
      // Check format legality
      const legalities = card.legalities || {};
      formatLegal = legalities[format] === 'legal';
      
      if (!formatLegal) {
        issues.push(`Card is not legal in ${format} (status: ${legalities[format] || 'unknown'})`);
      }
    
      // Check Arena availability
      const games = card.games || [];
      arenaAvailable = games.includes('arena');
      
      if (!arenaAvailable) {
        issues.push('Card is not available in Arena');
      }
    
      const isValid = commanderEligible && formatLegal && arenaAvailable;
    
      return {
        isValid,
        commanderEligible,
        formatLegal,
        arenaAvailable,
        issues
      };
    }
  • Input parameter validation helper: checks types, required fields, valid format enum, trims card_identifier.
    private validateParams(args: unknown): {
      card_identifier: string;
      format: 'brawl' | 'standardbrawl';
    } {
      if (!args || typeof args !== 'object') {
        throw new ValidationError('Invalid parameters');
      }
    
      const params = args as any;
    
      if (!params.card_identifier || typeof params.card_identifier !== 'string') {
        throw new ValidationError('Card identifier is required and must be a string');
      }
    
      if (!params.format || typeof params.format !== 'string') {
        throw new ValidationError('Format is required and must be a string');
      }
    
      const validFormats = ['brawl', 'standardbrawl'];
      if (!validFormats.includes(params.format)) {
        throw new ValidationError(`Format must be one of: ${validFormats.join(', ')}`);
      }
    
      return {
        card_identifier: params.card_identifier.trim(),
        format: params.format as 'brawl' | 'standardbrawl'
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what the tool does without disclosing behavioral traits. It doesn't mention error handling, response format, rate limits, or whether this is a read-only operation (though implied by 'validate'). For a tool with no annotations, this leaves significant behavioral 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?

Single sentence that efficiently communicates the core purpose with zero waste. Every word earns its place - 'validate', 'card', 'legal commander', and 'Brawl or Standard Brawl formats' are all essential information.

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

Completeness2/5

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

For a validation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what constitutes a 'legal commander', what the validation criteria are, what the response looks like, or error conditions. The description should provide more context given the lack of structured metadata.

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 both parameters thoroughly. The description doesn't add any parameter semantics beyond what's in the schema - it doesn't explain validation logic, format differences, or provide examples. 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 ('validate') and resource ('card') with precise context ('legal commander in Brawl or Standard Brawl formats'). It distinguishes from siblings like 'get_card' or 'search_cards' by focusing on format legality validation rather than retrieval or search.

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 when checking commander legality, but doesn't explicitly state when to use this tool versus alternatives like 'query_rules' or 'search_format_staples'. It provides basic context but lacks explicit guidance on prerequisites or comparisons with sibling tools.

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

Related 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/bmurdock/scryfall-mcp'

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