Skip to main content
Glama

get_glossary

Look up Magic: The Gathering glossary terms. Use to define game-specific words like 'permanent' or 'spell' with partial matching support.

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

  • Main handler function that queries the SQLite database for glossary terms, first by exact match (case-insensitive), then by partial match, returning entries or a 'not found' message.
    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}"`,
      };
    }
  • Zod input schema for 'get_glossary': accepts a 'term' string for case-insensitive exact/partial matching.
    export const GetGlossaryInput = z.object({
      term: z.string().describe('Glossary term to look up (case-insensitive). Supports exact and partial matching.'),
    });
  • Output types: GlossaryEntry interface and GetGlossaryResult discriminated union (found/not found).
    export interface GlossaryEntry {
      term: string;
      definition: string;
    }
    
    export type GetGlossaryResult = {
      found: true;
      entries: GlossaryEntry[];
    } | {
      found: false;
      message: string;
    };
  • src/server.ts:165-177 (registration)
    Registration of the 'get_glossary' tool on the MCP server with its description, input schema, and handler invocation.
    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 };
        }
      },
    );
  • Formatting helper that converts the GetGlossaryResult into a human-readable string.
    export function formatGetGlossary(result: GetGlossaryResult): string {
      if (!result.found) {
        return result.message;
      }
    
      const lines: string[] = [];
      for (const entry of result.entries) {
        lines.push(`**${entry.term}**: ${entry.definition}`);
      }
    
      return lines.join('\n\n');
    }
Behavior4/5

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

With no annotations, the description carries full burden. It discloses case-insensitivity and partial matching support, which are key behaviors for a glossary lookup. No side effects or destructive actions are relevant, so transparency is adequate.

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 concise—two sentences with no filler. It front-loads the action and purpose, then provides usage guidance, making it efficient for an agent to parse.

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

Completeness5/5

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

Given the tool's simplicity (one parameter, no output schema), the description fully covers purpose, usage, and behavior. It is complete for an agent to select and invoke the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (one parameter 'term' described). The description adds value by stating the parameter is case-insensitive and supports partial matching, which is not 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 tool's purpose: 'Look up a term in the Magic: The Gathering glossary.' It specifies the verb (look up) and resource (glossary), and distinguishes from sibling tools by focusing on game-specific terminology like 'permanent', 'spell', etc.

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

Usage Guidelines4/5

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

The description provides explicit usage context: 'Use this when a user asks "what does X mean" for game-specific terminology.' It gives examples and implies when not to use (e.g., for card rules, use get_rulings or lookup_rule), though it does not name alternatives explicitly.

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

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