Skip to main content
Glama
bmurdock

Scryfall MCP Server

by bmurdock

search_format_staples

Identify meta-relevant cards for Magic: The Gathering formats, filtered by role, tier, color, and price. Optimize deckbuilding with targeted card recommendations for competitive play.

Instructions

Find format staples, meta cards, and role-specific cards for competitive play

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
color_identityNoColor identity filter (e.g., "wr", "grixis", "colorless")
formatYesMagic format to analyze
limitNoNumber of results to return
max_priceNoMaximum price in USD
roleNoCard role in deck archetypes
tierNoMeta tier levelcompetitive

Implementation Reference

  • The main handler method that validates input, builds Scryfall search query based on format staples parameters, executes the search, formats results as text, and handles errors.
    async execute(args: unknown) {
      try {
        // Validate parameters
        const params = this.validateParams(args);
    
        // Build search query
        const query = this.buildSearchQuery(params);
    
        // Execute search
        const results = await this.scryfallClient.searchCards({
          query,
          limit: params.limit,
          order: this.getOrderForTier(params.tier)
        });
    
        // Format results
        const responseText = formatSearchResultsAsText(results);
    
        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
          };
        }
    
        // Generic error handling
        return {
          content: [
            {
              type: 'text',
              text: `Unexpected error: ${error instanceof Error ? error.message : 'Unknown error occurred'}`
            }
          ],
          isError: true
        };
      }
    }
  • Input schema defining parameters for format, tier, role, color identity, max price, and limit. Requires 'format'.
    readonly inputSchema = {
      type: 'object' as const,
      properties: {
        format: {
          type: 'string',
          enum: ['standard', 'modern', 'legacy', 'vintage', 'commander', 'pioneer', 'brawl', 'standardbrawl'],
          description: 'Magic format to analyze'
        },
        tier: {
          type: 'string',
          enum: ['top', 'competitive', 'budget', 'fringe'],
          default: 'competitive',
          description: 'Meta tier level'
        },
        role: {
          type: 'string',
          enum: ['removal', 'threats', 'utility', 'lands', 'ramp', 'draw', 'counterspells'],
          description: 'Card role in deck archetypes'
        },
        color_identity: {
          type: 'string',
          description: 'Color identity filter (e.g., "wr", "grixis", "colorless")'
        },
        max_price: {
          type: 'number',
          minimum: 0,
          description: 'Maximum price in USD'
        },
        limit: {
          type: 'number',
          default: 20,
          minimum: 1,
          maximum: 100,
          description: 'Number of results to return'
        }
      },
      required: ['format']
    };
  • src/server.ts:72-72 (registration)
    Registration of the SearchFormatStaplesTool instance in the tools Map using the name 'search_format_staples'.
    this.tools.set("search_format_staples", new SearchFormatStaplesTool(this.scryfallClient));
  • Helper method to construct the Scryfall search query string based on input parameters including format, role, colors, price, and tier filters.
    private buildSearchQuery(params: {
      format: string;
      tier: string;
      role?: string;
      color_identity?: string;
      max_price?: number;
    }): string {
      let query = `f:${params.format}`;
    
      // Add role-specific search terms
      if (params.role) {
        query += ` ${this.getRoleSearchTerms(params.role)}`;
      }
    
      // Add color identity filter
      if (params.color_identity) {
        query += ` ${this.getColorIdentityFilter(params.color_identity)}`;
      }
    
      // Add price filter
      if (params.max_price !== undefined) {
        query += ` usd<=${params.max_price}`;
      }
    
      // Add tier-specific filters
      query += ` ${this.getTierFilter(params.tier)}`;
    
      return query;
    }
  • Helper method for input validation, checking types, required fields, enums for format/tier/role, and bounds for price/limit.
    private validateParams(args: unknown): {
      format: string;
      tier: string;
      role?: string;
      color_identity?: string;
      max_price?: number;
      limit: number;
    } {
      if (!args || typeof args !== 'object') {
        throw new ValidationError('Invalid parameters');
      }
    
      const params = args as any;
    
      if (!params.format || typeof params.format !== 'string') {
        throw new ValidationError('Format is required and must be a string');
      }
    
      const validFormats = ['standard', 'modern', 'legacy', 'vintage', 'commander', 'pioneer', 'brawl', 'standardbrawl'];
      if (!validFormats.includes(params.format)) {
        throw new ValidationError(`Format must be one of: ${validFormats.join(', ')}`);
      }
    
      const tier = params.tier || 'competitive';
      const validTiers = ['top', 'competitive', 'budget', 'fringe'];
      if (!validTiers.includes(tier)) {
        throw new ValidationError(`Tier must be one of: ${validTiers.join(', ')}`);
      }
    
      if (params.role) {
        const validRoles = ['removal', 'threats', 'utility', 'lands', 'ramp', 'draw', 'counterspells'];
        if (!validRoles.includes(params.role)) {
          throw new ValidationError(`Role must be one of: ${validRoles.join(', ')}`);
        }
      }
    
      if (params.max_price !== undefined) {
        if (typeof params.max_price !== 'number' || params.max_price < 0) {
          throw new ValidationError('Max price must be a non-negative number');
        }
      }
    
      const limit = params.limit || 20;
      if (typeof limit !== 'number' || limit < 1 || limit > 100) {
        throw new ValidationError('Limit must be a number between 1 and 100');
      }
    
      return {
        format: params.format,
        tier,
        role: params.role,
        color_identity: params.color_identity,
        max_price: params.max_price,
        limit
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'find' but doesn't clarify if this is a read-only operation, what the output format looks like, or any limitations (e.g., rate limits, data freshness). For a search tool with 6 parameters and no annotations, this lack of behavioral context is a significant gap.

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 a single, efficient sentence that front-loads the core purpose without unnecessary words. It directly states what the tool does and the context, earning its place with zero waste.

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?

Given the complexity (6 parameters, no output schema, no annotations), the description is incomplete. It lacks details on behavioral traits, output format, and usage guidelines. While the schema covers parameters well, the description doesn't compensate for missing annotations or output information, making it inadequate for full agent understanding.

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 fully documents all 6 parameters with descriptions and enums. The description adds no additional parameter semantics beyond implying a focus on competitive play, which aligns with the 'tier' parameter. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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: 'Find format staples, meta cards, and role-specific cards for competitive play.' It specifies the verb 'find' and the resources (staples, meta cards, role-specific cards), and mentions the context (competitive play). However, it doesn't explicitly differentiate from sibling tools like 'search_cards' or 'search_alternatives' beyond the competitive focus.

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

Usage Guidelines2/5

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

The description provides minimal guidance on when to use this tool. It implies usage for competitive play analysis but doesn't specify when to choose it over alternatives like 'search_cards' or 'find_synergistic_cards.' No exclusions or prerequisites are mentioned, leaving the agent with little context for tool selection.

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