mark_notification_read
Mark a single notification as read by providing its unique ID.
Instructions
Mark a single notification as read. Requires IWMM_API_KEY.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/tools/notifications.ts:19-25 (handler)The markNotificationReadTool object definition, containing the handler function that calls apiFetch to PATCH /api/v1/notifications/{id}/read, marking a single notification as read. Accepts a string 'id' parameter.
export const markNotificationReadTool = { name: "mark_notification_read", description: "Mark a single notification as read. Requires IWMM_API_KEY.", inputSchema: z.object({ id: z.string() }), handler: ({ id }: { id: string }) => apiFetch({ path: `/api/v1/notifications/${encodeURIComponent(id)}/read`, method: "PATCH", authenticated: true }), }; - src/tools/notifications.ts:22-22 (schema)Input schema for mark_notification_read: requires a single string field 'id' validated by Zod.
inputSchema: z.object({ id: z.string() }), - src/tools/index.ts:86-88 (registration)markNotificationReadTool is included in the exported 'tools' array, registering it as an available MCP tool.
markNotificationReadTool, markAllNotificationsReadTool, ]; - src/api-client.ts:26-67 (helper)The apiFetch helper function used by the handler to make authenticated HTTP requests to the IWMM 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; }