Skip to main content
Glama

lookup_rule

Find Magic: The Gathering rules by section number or search text to resolve gameplay questions and verify official rule interactions.

Instructions

Look up a specific section of the Magic: The Gathering Comprehensive Rules by section number (e.g., "702", "702.1") or search rules text. Use this when a user asks about specific game rules, rule interactions, or needs the official rule text. Returns the rule and its subsections.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sectionNoRule section number to look up (e.g. "702" or "702.1"). Returns exact match plus all subsections.
queryNoText to search for across all rule titles and text (case-insensitive).

Implementation Reference

  • The handler function that dispatches the request to either lookupBySection or searchByText based on the provided params.
    export function handler(db: Database.Database, params: LookupRuleParams): LookupRuleResult {
      if (params.section) {
        return lookupBySection(db, params.section);
      }
      return searchByText(db, params.query!);
    }
  • Input validation schema for the lookup_rule tool.
    export const LookupRuleInput = z.object({
      section: z.string().optional().describe('Rule section number to look up (e.g. "702" or "702.1"). Returns exact match plus all subsections.'),
      query: z.string().optional().describe('Text to search for across all rule titles and text (case-insensitive).'),
    }).refine(data => data.section || data.query, {
      message: 'Either section or query must be provided',
    });
  • src/server.ts:163-169 (registration)
    The registration and invocation of lookup_rule in the main MCP server.
    'lookup_rule',
    'Look up a specific section of the Magic: The Gathering Comprehensive Rules by section number (e.g., "702", "702.1") or search rules text. Use this when a user asks about specific game rules, rule interactions, or needs the official rule text. Returns the rule and its subsections.',
    LookupRuleInput.innerType().shape,
    async (params) => {
      try {
        const result = lookupRuleHandler(db, params);
        return { content: [{ type: 'text' as const, text: formatLookupRule(result) }] };
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It adequately describes the lookup/search functionality and return format ('Returns the rule and its subsections'), but doesn't mention important behavioral aspects like rate limits, authentication requirements, error conditions, or pagination behavior for search results.

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 perfectly concise with three focused sentences that each earn their place: first defines the core functionality, second provides usage guidance, third describes the return value. No wasted words, well-structured, and front-loaded with the most important information.

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

Completeness4/5

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

For a read-only lookup tool with no annotations and no output schema, the description provides good coverage of purpose, usage, and return format. However, it could be more complete by addressing potential edge cases (what happens with invalid section numbers, how search results are limited/ordered) and clarifying the relationship between the two parameters (mutually exclusive? can both be used?).

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 already fully documents both parameters. The description adds some context about parameter usage ('section number to look up', 'search rules text') but doesn't provide additional semantic meaning beyond what's in the schema descriptions. Baseline 3 is appropriate when schema does the heavy lifting.

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 with specific verbs ('look up', 'search') and resources ('Magic: The Gathering Comprehensive Rules', 'section number', 'rules text'). It distinguishes this tool from siblings by focusing on rule lookup rather than card analysis, deck building, or price checking.

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 clear context for when to use this tool ('when a user asks about specific game rules, rule interactions, or needs the official rule text'). However, it doesn't explicitly state when NOT to use it or mention specific alternatives among the sibling tools for related queries.

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