mark_all_notifications_read
Clears all unread notifications for the authenticated user, removing all alerts at once.
Instructions
Mark every notification for the authenticated user as read. Requires IWMM_API_KEY.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/notifications.ts:27-32 (handler)The handler for 'mark_all_notifications_read' - calls apiFetch with PATCH method on /api/v1/notifications/read-all. This is both the handler and the schema definition (inline).
export const markAllNotificationsReadTool = { name: "mark_all_notifications_read", description: "Mark every notification for the authenticated user as read. Requires IWMM_API_KEY.", inputSchema: z.object({}), handler: () => apiFetch({ path: "/api/v1/notifications/read-all", method: "PATCH", authenticated: true }), }; - src/tools/notifications.ts:27-32 (schema)Input schema is z.object({}) (no arguments required), defined inline in the tool definition object.
export const markAllNotificationsReadTool = { name: "mark_all_notifications_read", description: "Mark every notification for the authenticated user as read. Requires IWMM_API_KEY.", inputSchema: z.object({}), handler: () => apiFetch({ path: "/api/v1/notifications/read-all", method: "PATCH", authenticated: true }), }; - src/tools/index.ts:87-87 (registration)The tool is imported from notifications.ts and added to the tools array at line 87, making it available for registration.
markAllNotificationsReadTool, - src/tools/index.ts:34-39 (registration)Import of markAllNotificationsReadTool from notifications.ts at line 38.
import { listNotificationsTool, getUnreadCountTool, markNotificationReadTool, markAllNotificationsReadTool, } from "./notifications.js"; - src/api-client.ts:26-67 (helper)The apiFetch helper function used by the handler to make the authenticated PATCH request to the 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; }