trigger_plaid_fetch
Fetch updated transactions from Plaid, with optional date range and account filter. Requests require a 60-second interval.
Instructions
Trigger a fetch of latest data from Plaid. Optionally scope the fetch to a date range and/or a specific Plaid account ID. Note: Plaid enforces a minimum 60-second delay between fetch requests; fetching may take up to 5 minutes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| start_date | No | Beginning of the date range to fetch transactions for (YYYY-MM-DD). Required if end_date is set. | |
| end_date | No | End of the date range to fetch transactions for (YYYY-MM-DD). Required if start_date is set. | |
| id | No | If set, only fetch the specified Plaid account; otherwise all eligible accounts are fetched. |
Implementation Reference
- src/tools/plaid-accounts.ts:102-128 (handler)The async handler function that triggers a Plaid fetch. Builds query params (start_date, end_date, id) and POSTs to /plaid_accounts/fetch with query string. Returns success message or handles errors.
async ({ start_date, end_date, id }) => { try { const params = new URLSearchParams(); if (start_date) params.append("start_date", start_date); if (end_date) params.append("end_date", end_date); if (id !== undefined) params.append("id", String(id)); const qs = params.toString(); const response = await api.post( `/plaid_accounts/fetch${qs ? `?${qs}` : ""}`, ); if (!response.ok) { return handleApiError( response, "Failed to trigger Plaid fetch", ); } return successResponse( "Plaid fetch accepted. Fetching may take up to 5 minutes; query get_all_plaid_accounts to check plaid_last_successful_update / last_import.", ); } catch (error) { return catchError(error, "Failed to trigger Plaid fetch"); } }, ); - src/tools/plaid-accounts.ts:78-97 (schema)The input schema (Zod-based) for trigger_plaid_fetch, defining optional start_date (YYYY-MM-DD), end_date (YYYY-MM-DD), and id (number for a specific Plaid account).
inputSchema: { start_date: z .string() .optional() .describe( "Beginning of the date range to fetch transactions for (YYYY-MM-DD). Required if end_date is set.", ), end_date: z .string() .optional() .describe( "End of the date range to fetch transactions for (YYYY-MM-DD). Required if start_date is set.", ), id: z.coerce .number() .optional() .describe( "If set, only fetch the specified Plaid account; otherwise all eligible accounts are fetched.", ), }, - src/tools/plaid-accounts.ts:73-74 (registration)Registration of the tool named 'trigger_plaid_fetch' via server.registerTool() with description and annotations (openWorldHint).
server.registerTool( "trigger_plaid_fetch", - src/index.ts:32-32 (registration)Top-level entry point that calls registerPlaidAccountTools(server) to register all Plaid account tools including trigger_plaid_fetch.
registerPlaidAccountTools(server); - src/api.ts:146-153 (helper)The api.post() helper used by the handler to make the HTTP POST request to the LunchMoney API.
export const api = { get: (path: string) => apiRequest("GET", path), post: (path: string, body?: unknown) => apiRequest("POST", path, body), put: (path: string, body: unknown) => apiRequest("PUT", path, body), delete: (path: string, body?: unknown) => apiRequest("DELETE", path, body), upload: (path: string, formData: FormData) => apiUpload("POST", path, formData), };