list_transactions
List your paginated transactions with sorting and filtering by type. Free accounts see the last 30 days; premium accounts access full history.
Instructions
List the authenticated user's transactions, paginated. Supports sort/filter query params. Free tier sees the last 30 days only; Premium gets full history. Requires IWMM_API_KEY.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | ||
| limit | No | ||
| sort | No | Sort key (e.g. TX_DATE, TX_TYPE, TX_CARD, TX_PRICE). | |
| order | No | ||
| type | No |
Implementation Reference
- src/tools/transactions.ts:29-46 (handler)The full tool definition for 'list_transactions' including its input schema and handler. The handler performs an authenticated GET request to /api/v1/transactions, passing optional pagination/sort/filter query parameters.
export const listTransactionsTool = { name: "list_transactions", description: "List the authenticated user's transactions, paginated. Supports sort/filter query params. Free tier sees the last 30 days only; Premium gets full history. Requires IWMM_API_KEY.", inputSchema: z.object({ page: z.number().int().min(1).optional(), limit: z.number().int().min(1).max(100).optional(), sort: z.string().optional().describe("Sort key (e.g. TX_DATE, TX_TYPE, TX_CARD, TX_PRICE)."), order: z.enum(["asc", "desc"]).optional(), type: z.enum(["BUY", "SELL"]).optional(), }), handler: (input: Record<string, unknown>) => apiFetch({ path: "/api/v1/transactions", query: input as Record<string, string | number | undefined>, authenticated: true, }), }; - src/tools/transactions.ts:33-39 (schema)The Zod input schema for list_transactions: optional page, limit, sort field, sort order, and transaction type filter (BUY/SELL).
inputSchema: z.object({ page: z.number().int().min(1).optional(), limit: z.number().int().min(1).max(100).optional(), sort: z.string().optional().describe("Sort key (e.g. TX_DATE, TX_TYPE, TX_CARD, TX_PRICE)."), order: z.enum(["asc", "desc"]).optional(), type: z.enum(["BUY", "SELL"]).optional(), }), - src/tools/index.ts:65-65 (registration)listTransactionsTool is included in the tools array exported from src/tools/index.ts, registering it as an available MCP tool.
listTransactionsTool, - src/tools/index.ts:90-92 (registration)toolsByName maps the string 'list_transactions' to the listTransactionsTool object for runtime lookup when the tool is invoked.
export const toolsByName: Record<string, ToolDefinition> = Object.fromEntries( tools.map((t) => [t.name, t]), ); - src/api-client.ts:26-67 (helper)The apiFetch helper function used by the handler to execute the HTTP request. It constructs the URL with query params, attaches the Bearer auth token if authenticated=true, and returns parsed JSON.
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; }