remove_inventory
Removes a specific card and finish combination from your MTG inventory using the authenticated user's API key.
Instructions
Remove a card+finish row from the authenticated user's inventory. Requires IWMM_API_KEY.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cardId | Yes | ||
| isFoil | Yes |
Implementation Reference
- src/tools/inventory.ts:44-53 (handler)The handler for the remove_inventory tool. Sends a DELETE request to /api/v1/inventory with cardId and isFoil in the body. Authenticated via API key.
export const removeInventoryTool = { name: "remove_inventory", description: "Remove a card+finish row from the authenticated user's inventory. Requires IWMM_API_KEY.", inputSchema: z.object({ cardId: z.string().uuid(), isFoil: z.boolean(), }), handler: (input: { cardId: string; isFoil: boolean }) => apiFetch({ path: "/api/v1/inventory", method: "DELETE", body: input, authenticated: true }), }; - src/tools/inventory.ts:47-50 (schema)Input schema for remove_inventory: requires cardId (UUID string) and isFoil (boolean).
inputSchema: z.object({ cardId: z.string().uuid(), isFoil: z.boolean(), }), - src/tools/index.ts:63-63 (registration)Tool registered in the tools array (line 63) and also available via toolsByName map (lines 90-92).
removeInventoryTool, - src/tools/index.ts:9-11 (registration)Import of removeInventoryTool from inventory.ts module.
removeInventoryTool, getInventoryQuantitiesTool, } from "./inventory.js"; - src/api-client.ts:26-67 (helper)The apiFetch helper used by the handler to make HTTP requests to the IWMM API. Automatically adds Authorization header when authenticated=true.
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; }