Skip to main content
Glama
matthewdtowles

iwantmymtg-mcp

get_card_price_history

Retrieve 30-day price history for a specific card printing, including normal and foil variants, with older data retained on a weekly/monthly cadence.

Instructions

Get the 30-day price history for a card printing (normal + foil). Older data is retained on a weekly/monthly cadence beyond 30 days.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
setCodeYesSet code (e.g. 'lea').
setNumberYesCollector number within the set (e.g. '161'). String, not int - some sets use suffixes like '12a'.

Implementation Reference

  • The handler function for 'get_card_price_history'. It takes setCode and setNumber as input, and makes a GET request to /api/v1/cards/{setCode}/{setNumber}/price-history to retrieve price history data (30-day history, with older data retained weekly/monthly).
    export const getCardPriceHistoryTool = {
      name: "get_card_price_history",
      description:
        "Get the 30-day price history for a card printing (normal + foil). Older data is retained on a weekly/monthly cadence beyond 30 days.",
      inputSchema: z.object(getCardInputSchema),
      handler: async (input: { setCode: string; setNumber: string }) =>
        apiFetch({
          path: `/api/v1/cards/${encodeURIComponent(input.setCode)}/${encodeURIComponent(input.setNumber)}/price-history`,
        }),
    };
  • The input schema shared by all get-card tools. Defines two required string fields: setCode (e.g. 'lea') and setNumber (e.g. '161' or '12a' with suffix).
    export const getCardInputSchema = {
      setCode: z.string().describe("Set code (e.g. 'lea')."),
      setNumber: z.string().describe("Collector number within the set (e.g. '161'). String, not int - some sets use suffixes like '12a'."),
    };
  • The tools array registration. getCardPriceHistoryTool is included at index 53 (read-only, no auth required) and also indexed by name in the toolsByName map.
    export const tools: ToolDefinition[] = [
      // Read-only (no auth)
      searchCardsTool,
      getCardTool,
      getCardPricesTool,
      getCardPriceHistoryTool,
      searchSetsTool,
      getSetTool,
      listSetCardsTool,
      getSealedProductsTool,
      // Inventory (auth)
      listInventoryTool,
      getInventoryQuantitiesTool,
      addInventoryTool,
      updateInventoryTool,
      removeInventoryTool,
      // Transactions (auth)
      listTransactionsTool,
      recordTransactionTool,
      updateTransactionTool,
      deleteTransactionTool,
      getCostBasisTool,
      // Portfolio (auth; most are Premium-gated)
      getPortfolioSummaryTool,
      getPortfolioHistoryTool,
      getCardPerformanceTool,
      getCashFlowTool,
      getRealizedGainsTool,
      getPortfolioBreakdownTool,
      refreshPortfolioTool,
      // Price alerts (auth)
      listAlertsTool,
      createAlertTool,
      updateAlertTool,
      deleteAlertTool,
      // Notifications (auth)
      listNotificationsTool,
      getUnreadCountTool,
      markNotificationReadTool,
      markAllNotificationsReadTool,
    ];
    
    export const toolsByName: Record<string, ToolDefinition> = Object.fromEntries(
      tools.map((t) => [t.name, t]),
    );
  • The apiFetch helper used by the handler to make HTTP requests. Constructs a URL, adds headers (including optional Bearer auth), and parses JSON responses. Errors (non-OK statuses) throw ApiError with optional rate limit info.
    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;
    }
Behavior3/5

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

No annotations are provided, so the description bears full burden. It discloses the data retention behavior (30-day daily, older weekly/monthly) but omits details on authentication, rate limits, or what happens when no data exists. This is adequate but not thorough.

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?

Two sentences with zero wasted words. The action and scope are front-loaded, and the additional sentence adds valuable context about data retention without redundancy.

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?

The description covers what data is returned (30-day history with older aggregated data) but lacks information about output format or structure. Since there is no output schema, the description should hint at the response shape; its absence makes it slightly incomplete.

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 baseline is 3. The description does not add any additional meaning beyond the parameter names and descriptions already 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 specifies the verb 'Get', resource 'price history', and scope '30-day' with detail on normal + foil printing. It clearly distinguishes from sibling tools like get_card_prices (current prices) and get_card_performance (longer-term performance).

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

Usage Guidelines3/5

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

The description implies usage for recent 30-day history, added by the note on older data retention. However, it does not explicitly state when to use this tool versus alternatives like get_card_prices or get_card_performance, nor does it mention when not to use it.

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