Skip to main content
Glama
matthewdtowles

iwantmymtg-mcp

list_inventory

Fetch and view your MTG card inventory with paginated results, including quantities, prices, and metadata.

Instructions

List the authenticated user's card inventory, paginated. Requires IWMM_API_KEY. Returns cards with quantities, prices, and metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNo
limitNo

Implementation Reference

  • The handler function that executes the list_inventory tool logic. Calls apiFetch with GET /api/v1/inventory and passes query params (page, limit). Requires authentication via IWMM_API_KEY.
    handler: (input: Record<string, unknown>) =>
      apiFetch({
        path: "/api/v1/inventory",
        query: input as Record<string, string | number | undefined>,
        authenticated: true,
      }),
  • Input schema for list_inventory: optional page (int >= 1) and limit (int 1-100) with Zod validation.
    inputSchema: z.object({
      page: z.number().int().min(1).optional(),
      limit: z.number().int().min(1).max(100).optional(),
    }),
  • The listInventoryTool is registered in the tools array at line 59 and also indexed by name in toolsByName at lines 90-92.
    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 authenticated HTTP requests to the IWMM 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;
    }
Behavior4/5

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

No annotations exist, so description carries burden. Discloses that it is paginated and what it returns. Could mention that it is read-only and non-destructive, but the verb 'List' implies safety.

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 only, no filler. Key information is front-loaded: action, resource, pagination, auth requirement, return content.

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?

Moderate complexity with two parameters and no output schema. Covers auth, pagination, and return fields. Lacks details on default behavior or error handling, but adequate for a simple list operation.

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

Parameters2/5

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

Schema description coverage is 0%, so description must explain parameters. It only says 'paginated' without detailing page and limit behavior, which are defined in schema but not elaborated in text.

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 tool lists the authenticated user's card inventory with pagination. Differentiates from siblings like add_inventory or get_inventory_quantities.

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?

Mentions requirement for IWMM_API_KEY, which is a prerequisite. Does not explicitly state when to use this tool vs alternatives, but context from sibling names provides some guidance.

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