Skip to main content
Glama

get_rulings

Retrieve official Magic: The Gathering card rulings to clarify interactions, edge cases, and unusual situations with timestamped Wizards of the Coast guidance.

Instructions

Get official rulings for a specific Magic card. Use this when a user asks about specific interactions, edge cases, or how a card works in unusual situations. Returns timestamped rulings from Wizards of the Coast.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
card_nameYesName of the card to get rulings for

Implementation Reference

  • The implementation of the get_rulings tool handler, which queries the database for cards and their associated rulings.
    export function handler(db: Database.Database, params: GetRulingsParams): GetRulingsResult {
      // Look up card by name (case-insensitive exact match first, then LIKE)
      let card = db.prepare(
        'SELECT * FROM cards WHERE LOWER(name) = LOWER(?)'
      ).get(params.card_name) as CardRow | undefined;
    
      if (!card) {
        card = db.prepare(
          'SELECT * FROM cards WHERE LOWER(name) LIKE LOWER(?)'
        ).get(`%${params.card_name}%`) as CardRow | undefined;
      }
    
      if (!card) {
        return {
          found: false,
          message: `No card found matching "${params.card_name}"`,
        };
      }
    
      const rows = db.prepare(
        'SELECT * FROM rulings WHERE card_id = ? ORDER BY published_at'
      ).all(card.id) as RulingRow[];
    
      return {
        found: true,
        card_name: card.name,
        rulings: rows.map(r => ({
          source: r.source,
          published_at: r.published_at,
          comment: r.comment,
        })),
      };
    }
  • Input schema for the get_rulings tool.
    export const GetRulingsInput = z.object({
      card_name: z.string().describe('Name of the card to get rulings for'),
    });
  • src/server.ts:118-126 (registration)
    Registration of the get_rulings tool in the MCP server.
    server.tool(
      'get_rulings',
      'Get official rulings for a specific Magic card. Use this when a user asks about specific interactions, edge cases, or how a card works in unusual situations. Returns timestamped rulings from Wizards of the Coast.',
      GetRulingsInput.shape,
      async (params) => {
        try {
          const result = getRulingsHandler(db, params);
          return { content: [{ type: 'text' as const, text: formatGetRulings(result) }] };
        } catch (err) {

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