update_inventory
Update quantities for one or more Magic: The Gathering inventory items by card ID and finish, with batch support. Requires API key.
Instructions
Update quantities for one or more existing inventory rows. Accepts a batch. Use remove_inventory to delete a row entirely. Requires IWMM_API_KEY.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes |
Implementation Reference
- src/tools/inventory.ts:35-42 (handler)The updateInventoryTool definition containing the 'update_inventory' tool. The handler calls apiFetch with PATCH method on /api/v1/inventory, performing the actual update logic.
export const updateInventoryTool = { name: "update_inventory", description: "Update quantities for one or more existing inventory rows. Accepts a batch. Use remove_inventory to delete a row entirely. Requires IWMM_API_KEY.", inputSchema: z.object({ items: z.array(inventoryItem).min(1) }), handler: (input: { items: z.infer<typeof inventoryItem>[] }) => apiFetch({ path: "/api/v1/inventory", method: "PATCH", body: input.items, authenticated: true }), }; - src/tools/inventory.ts:4-8 (schema)The inventoryItem Zod schema used as input validation for update_inventory. Defines cardId (UUID), quantity (int >= 0), and isFoil (boolean).
const inventoryItem = z.object({ cardId: z.string().uuid().describe("Internal IWMM card UUID. Get from search_cards or get_card."), quantity: z.number().int().min(0).describe("Total quantity for this card+finish. 0 removes the row."), isFoil: z.boolean().describe("Whether this is the foil variant. Foil and non-foil are tracked as separate rows."), }); - src/tools/inventory.ts:35-39 (schema)The inputSchema for update_inventory: a Zod object wrapping an array of inventoryItem with at least 1 item.
export const updateInventoryTool = { name: "update_inventory", description: "Update quantities for one or more existing inventory rows. Accepts a batch. Use remove_inventory to delete a row entirely. Requires IWMM_API_KEY.", inputSchema: z.object({ items: z.array(inventoryItem).min(1) }), - src/tools/index.ts:8-8 (registration)Import of updateInventoryTool from ./inventory.js into the tools registry.
updateInventoryTool, - src/tools/index.ts:62-62 (registration)Registration of updateInventoryTool in the tools array, making it available as a named MCP tool.
updateInventoryTool,