Skip to main content
Glama
bmurdock

Scryfall MCP Server

by bmurdock

get_card

Retrieve detailed Magic: The Gathering card information by name, set code+number, or Scryfall ID. Includes card images, language options, and face selection for double-faced cards via the Scryfall MCP Server.

Instructions

Get detailed information about a specific Magic: The Gathering card by name, set code+number, or Scryfall ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
faceNoWhich face to show for double-faced cards
identifierYesCard name, set code+collector number (e.g., "dom/123"), or Scryfall UUID
include_imageNoInclude image URL in response
langNo2-letter language code (default: en)en
setNo3-letter set code for disambiguation when using card name

Implementation Reference

  • The main handler function that validates input, fetches card data from ScryfallClient, formats the response, and handles various errors including validation, rate limits, and API errors.
    async execute(args: unknown) {
      try {
        // Validate parameters
        const params = validateGetCardParams(args);
        
        // Sanitize and validate card identifier
        const sanitizedIdentifier = sanitizeCardIdentifier(params.identifier);
        validateCardIdentifier(sanitizedIdentifier);
    
        // Execute card lookup
        const card = await this.scryfallClient.getCard({
          identifier: sanitizedIdentifier,
          set: params.set,
          lang: params.lang,
          face: params.face
        });
    
        // Format detailed card information
        const responseText = formatCardDetails(card, params.include_image);
    
        return {
          content: [
            {
              type: 'text',
              text: responseText
            }
          ]
        };
    
      } catch (error) {
        // Handle different error types
        if (error instanceof ValidationError) {
          return {
            content: [
              {
                type: 'text',
                text: `Validation error: ${error.message}`
              }
            ],
            isError: true
          };
        }
    
        if (error instanceof RateLimitError) {
          const retry = error.retryAfter ? ` Retry after ${error.retryAfter}s.` : '';
          return {
            content: [{ type: 'text', text: `Rate limit exceeded.${retry} Please wait and try again.` }],
            isError: true
          };
        }
    
        if (error instanceof ScryfallAPIError) {
          let errorMessage = `Scryfall API error: ${error.message}`;
          
          if (error.status === 404) {
            errorMessage = `Card not found: "${(args as GetCardParams)?.identifier ?? 'unknown'}". Check the card name, set code, or ID.`;
          } else if (error.status === 422) {
            errorMessage = `Invalid card identifier format. Use card name, "SET/NUMBER", or Scryfall UUID.`;
          } else if (error.status === 429) {
            errorMessage = 'Rate limit exceeded. Please wait a moment and try again.';
          }
    
          return {
            content: [
              {
                type: 'text',
                text: errorMessage
              }
            ],
            isError: true
          };
        }
    
        // Generic error handling with enhanced context
        const errorDetails = this.formatGenericError(error, args as GetCardParams);
        return {
          content: [
            {
              type: 'text',
              text: errorDetails
            }
          ],
          isError: true
        };
      }
    }
  • Input schema defining the parameters accepted by the get_card tool, including identifier (required), set, lang, face, and include_image.
    readonly inputSchema = {
      type: 'object' as const,
      properties: {
        identifier: {
          type: 'string',
          description: 'Card name, set code+collector number (e.g., "dom/123"), or Scryfall UUID'
        },
        set: {
          type: 'string',
          description: '3-letter set code for disambiguation when using card name',
          pattern: '^[a-zA-Z0-9]{3,4}$'
        },
        lang: {
          type: 'string',
          description: '2-letter language code (default: en)',
          pattern: '^[a-z]{2}$',
          default: 'en'
        },
        face: {
          type: 'string',
          enum: ['front', 'back'],
          description: 'Which face to show for double-faced cards'
        },
        include_image: {
          type: 'boolean',
          description: 'Include image URL in response',
          default: true
        }
      },
      required: ['identifier']
  • src/server.ts:67-67 (registration)
    Registers the GetCardTool instance in the server's tools Map under the name 'get_card', making it available for MCP tool calls.
    this.tools.set("get_card", new GetCardTool(this.scryfallClient));
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, not how it behaves. It lacks disclosure about response format, error handling, rate limits, authentication needs, or whether it's a read-only operation. For a tool with 5 parameters and no annotation coverage, this 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 immediately conveys the core functionality without unnecessary words. It's front-loaded with the primary purpose and includes essential details about identification methods, making every word earn its place.

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 tool with 5 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what 'detailed information' includes, how results are structured, error conditions, or behavioral constraints. Given the complexity and lack of structured data, the description should provide more complete operational context.

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%, providing detailed documentation for all 5 parameters. The description adds minimal value beyond the schema by mentioning the three identification methods, which partially maps to the 'identifier' parameter. However, it doesn't explain parameter interactions or provide additional context beyond what's already in the schema.

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 action ('Get detailed information') and resource ('a specific Magic: The Gathering card'), specifying three distinct identification methods (name, set code+number, or Scryfall ID). This distinguishes it from siblings like search_cards (which returns multiple results) or get_card_prices (which focuses on pricing data).

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 by stating it retrieves information about 'a specific' card, suggesting it's for single-card lookup rather than batch operations. However, it doesn't explicitly contrast with alternatives like search_cards (for multiple cards) or batch_card_analysis, nor does it mention when not to use it (e.g., for price data).

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