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
| Name | Required | Description | Default |
|---|---|---|---|
| cardIds | Yes |
Implementation Reference
- src/tools/inventory.ts:55-68 (handler)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, }), }; - src/tools/inventory.ts:59-61 (schema)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), }), - src/tools/index.ts:5-13 (registration)Import of getInventoryQuantitiesTool from inventory.ts into the central tools registry.
import { listInventoryTool, addInventoryTool, updateInventoryTool, removeInventoryTool, getInventoryQuantitiesTool, } from "./inventory.js"; import { listTransactionsTool, - src/tools/index.ts:59-60 (registration)Registration of the tool in the tools array at index 60, making it discoverable by clients.
listInventoryTool, getInventoryQuantitiesTool, - src/tools/index.ts:90-92 (registration)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]), );