Skip to main content
Glama
matthewdtowles

iwantmymtg-mcp

get_inventory_quantities

Retrieve how many copies (normal and foil) you own for a batch of Magic: The Gathering cards by providing their UUIDs. Helps verify inventory before making addition recommendations.

Instructions

Batch lookup: given a list of card UUIDs, return how many of each (normal + foil) the user owns. Useful before recommending adds. Requires IWMM_API_KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cardIdsYes

Implementation Reference

  • The tool definition including the handler function. It accepts an array of card UUIDs (1-200), joins them into a comma-separated query parameter, and calls GET /api/v1/inventory/quantities with authentication.
    export const getInventoryQuantitiesTool = {
      name: "get_inventory_quantities",
      description:
        "Batch lookup: given a list of card UUIDs, return how many of each (normal + foil) the user owns. Useful before recommending adds. Requires IWMM_API_KEY.",
      inputSchema: z.object({
        cardIds: z.array(z.string().uuid()).min(1).max(200),
      }),
      handler: ({ cardIds }: { cardIds: string[] }) =>
        apiFetch({
          path: "/api/v1/inventory/quantities",
          query: { cardIds: cardIds.join(",") },
          authenticated: true,
        }),
    };
  • Input validation schema using Zod: expects an object with a 'cardIds' array of UUID strings, minimum 1 and maximum 200 items.
    inputSchema: z.object({
      cardIds: z.array(z.string().uuid()).min(1).max(200),
    }),
  • Import of getInventoryQuantitiesTool from inventory.ts into the central tools registry.
    import {
      listInventoryTool,
      addInventoryTool,
      updateInventoryTool,
      removeInventoryTool,
      getInventoryQuantitiesTool,
    } from "./inventory.js";
    import {
      listTransactionsTool,
  • Registration of the tool in the tools array at index 60, making it discoverable by clients.
    listInventoryTool,
    getInventoryQuantitiesTool,
  • The toolsByName lookup map that enables routing by the tool name string 'get_inventory_quantities' to its handler at runtime.
    export const toolsByName: Record<string, ToolDefinition> = Object.fromEntries(
      tools.map((t) => [t.name, t]),
    );
Behavior4/5

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

No annotations exist, so the description must carry behavioral info. It discloses it is a read operation (returns counts) and requires an API key. It does not mention side effects, but none are expected.

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 efficient sentences: first explains function, second provides use case and requirement. No wasted words.

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 simple batch lookup with one parameter, the description covers purpose, usage, requirement, and basic output. Lacks detail on error handling or output format but is adequate.

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 coverage is 0%, so the description should compensate. It echoes 'card UUIDs' but does not explain format, constraints (max 200), or example values. Adds minimal 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?

The description clearly states the tool performs a batch lookup of card inventory quantities by UUID, specifying it returns normal and foil counts. It distinguishes from siblings like list_inventory and add_inventory.

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 suggests use 'before recommending adds', providing a clear context. It implies not for general inventory listing but does not explicitly list alternatives.

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