Skip to main content
Glama
matthewdtowles

iwantmymtg-mcp

get_set

Retrieve detailed information for a Magic: The Gathering set by providing its set code.

Instructions

Get detail for a single set by code (e.g. 'lea', 'mh3').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes

Implementation Reference

  • The 'get_set' tool handler function. Takes a set code, and fetches set details from the API via apiFetch.
    export const getSetTool = {
      name: "get_set",
      description: "Get detail for a single set by code (e.g. 'lea', 'mh3').",
      inputSchema: z.object({ code: z.string() }),
      handler: ({ code }: { code: string }) =>
        apiFetch({ path: `/api/v1/sets/${encodeURIComponent(code)}` }),
    };
  • Input schema for 'get_set' tool: requires a single string parameter 'code'.
    inputSchema: z.object({ code: z.string() }),
  • The 'getSetTool' is registered in the tools array at line 55.
    getSetTool,
  • Tools are also indexed by name in toolsByName for runtime lookup.
    export const toolsByName: Record<string, ToolDefinition> = Object.fromEntries(
      tools.map((t) => [t.name, t]),
    );
  • The apiFetch utility used by the handler to make HTTP requests to the backend API.
    export async function apiFetch<T = unknown>(req: ApiRequest): Promise<T> {
      const url = new URL(req.path, config.baseUrl);
      if (req.query) {
        for (const [k, v] of Object.entries(req.query)) {
          if (v !== undefined && v !== null && v !== "") {
            url.searchParams.set(k, String(v));
          }
        }
      }
    
      const headers: Record<string, string> = {
        Accept: "application/json",
        "User-Agent": "iwantmymtg-mcp/0.0.1",
      };
    
      if (req.authenticated) {
        const { requireApiKey } = await import("./config.js");
        headers["Authorization"] = `Bearer ${requireApiKey()}`;
      }
    
      if (req.body !== undefined) {
        headers["Content-Type"] = "application/json";
      }
    
      const res = await fetch(url, {
        method: req.method ?? "GET",
        headers,
        body: req.body !== undefined ? JSON.stringify(req.body) : undefined,
      });
    
      if (!res.ok) {
        const text = await res.text();
        throw new ApiError(res.status, text, {
          limit: res.headers.get("X-RateLimit-Limit") ?? undefined,
          remaining: res.headers.get("X-RateLimit-Remaining") ?? undefined,
          reset: res.headers.get("X-RateLimit-Reset") ?? undefined,
        });
      }
    
      if (res.status === 204) return undefined as T;
      return (await res.json()) as T;
    }
Behavior2/5

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

No annotations provided; description only states it's a 'Get' operation. Does not disclose side effects, authentication requirements, error behavior, or return format. For a tool with no annotations, the description carries full burden and fails to provide meaningful behavioral details beyond the action.

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?

Single sentence of 15 words, front-loaded with verb and resource. No filler or redundant information. Efficient and to the point.

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

Completeness3/5

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

Low complexity (one param), but missing output schema and annotations. Description is minimal; does not explain what the returned detail includes or error scenarios. Adequate for a simple retrieval endpoint but could be more thorough.

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?

Single parameter 'code' has 0% schema description coverage. Description provides examples ('lea', 'mh3') which add some meaning but does not explain what the parameter represents (set abbreviation? code format?). Adds marginal value beyond 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?

Clearly states the verb ('Get'), resource ('detail for a single set'), and identifier ('by code') with concrete examples ('lea', 'mh3'). Distinguishes from sibling tools like search_sets and list_set_cards.

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?

Implicitly tells when to use (to get a single set by code) but lacks explicit guidance on when not to use or alternatives. The sibling names provide context but the description doesn't reference them.

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/matthewdtowles/iwantmymtg-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server