Skip to main content
Glama

get_glossary

Look up Magic: The Gathering game terminology definitions to understand terms like 'permanent', 'spell', or 'stack' during gameplay.

Instructions

Look up a term in the Magic: The Gathering glossary. Use this when a user asks "what does X mean" for game-specific terminology like "permanent", "spell", "stack", "priority", etc. Supports partial matching.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
termYesGlossary term to look up (case-insensitive). Supports exact and partial matching.

Implementation Reference

  • The core handler function that executes the database query to retrieve glossary entries.
    export function handler(db: Database.Database, params: GetGlossaryParams): GetGlossaryResult {
      // 1. Exact match (case-insensitive)
      const exact = db.prepare(
        'SELECT * FROM glossary WHERE LOWER(term) = LOWER(?)'
      ).get(params.term) as GlossaryRow | undefined;
    
      if (exact) {
        return {
          found: true,
          entries: [{ term: exact.term, definition: exact.definition }],
        };
      }
    
      // 2. Partial match (case-insensitive)
      const partials = db.prepare(
        'SELECT * FROM glossary WHERE LOWER(term) LIKE LOWER(?) ORDER BY term LIMIT 20'
      ).all(`%${params.term}%`) as GlossaryRow[];
    
      if (partials.length > 0) {
        return {
          found: true,
          entries: partials.map(row => ({ term: row.term, definition: row.definition })),
        };
      }
    
      return {
        found: false,
        message: `No glossary entry found for "${params.term}"`,
      };
    }
  • Input validation schema for the get_glossary tool.
    export const GetGlossaryInput = z.object({
      term: z.string().describe('Glossary term to look up (case-insensitive). Supports exact and partial matching.'),
    });
  • src/server.ts:176-188 (registration)
    Tool registration in the MCP server.
    server.tool(
      'get_glossary',
      'Look up a term in the Magic: The Gathering glossary. Use this when a user asks "what does X mean" for game-specific terminology like "permanent", "spell", "stack", "priority", etc. Supports partial matching.',
      GetGlossaryInput.shape,
      async (params) => {
        try {
          const result = getGlossaryHandler(db, params);
          return { content: [{ type: 'text' as const, text: formatGetGlossary(result) }] };
        } catch (err) {
          return { content: [{ type: 'text' as const, text: `Error getting glossary entry: ${err instanceof Error ? err.message : String(err)}` }], isError: true };
        }
      },
    );

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