list_notifications
Retrieve price alert notifications for the authenticated user, including both read and unread messages, ordered by newest first.
Instructions
List the authenticated user's price alert notifications, newest first. Includes both read and unread. Requires IWMM_API_KEY.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/notifications.ts:4-10 (handler)Defines the list_notifications tool with handler that calls GET /api/v1/notifications with authentication
export const listNotificationsTool = { name: "list_notifications", description: "List the authenticated user's price alert notifications, newest first. Includes both read and unread. Requires IWMM_API_KEY.", inputSchema: z.object({}), handler: () => apiFetch({ path: "/api/v1/notifications", authenticated: true }), }; - src/tools/notifications.ts:8-8 (schema)Empty input schema (no arguments required) for the list_notifications tool
inputSchema: z.object({}), - src/tools/index.ts:34-39 (registration)Imports listNotificationsTool from notifications module
import { listNotificationsTool, getUnreadCountTool, markNotificationReadTool, markAllNotificationsReadTool, } from "./notifications.js"; - src/tools/index.ts:84-84 (registration)Registers listNotificationsTool in the tools array
listNotificationsTool, - src/api-client.ts:26-67 (helper)Generic API fetch helper used by the handler to make HTTP requests with authentication
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; }