chase_transactions
Retrieve recent transactions for a specific Chase account. Provide an account ID and optional limit to get a list of recent transactions.
Instructions
Get recent transactions for an account.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountId | Yes | The account ID to get transactions for | |
| limit | No | Maximum number of transactions to return (default: 25) |
Implementation Reference
- src/index.ts:92-110 (registration)Tool registration for 'chase_transactions' - defines the tool name, description, and input schema requiring accountId (string) with optional limit (number, default 25).
{ name: "chase_transactions", description: "Get recent transactions for an account.", inputSchema: { type: "object", properties: { accountId: { type: "string", description: "The account ID to get transactions for", }, limit: { type: "number", description: "Maximum number of transactions to return (default: 25)", }, }, required: ["accountId"], }, }, - src/index.ts:308-320 (handler)Handler that executes the 'chase_transactions' tool - extracts accountId and limit from arguments, calls getTransactions() from browser.ts, and returns structured JSON response with isError flag.
case "chase_transactions": { const { accountId, limit } = args as { accountId: string; limit?: number }; const result = await getTransactions(accountId, limit); return { content: [ { type: "text", text: JSON.stringify(result), }, ], isError: !result.success, }; } - src/browser.ts:222-276 (helper)The getTransactions() helper function - navigates to Chase dashboard, clicks the target account tile, scrapes transaction rows from the DOM (date, description, amount, type, category, pending status), and returns up to the specified limit.
export async function getTransactions( accountId: string, limit: number = 25 ): Promise<{ success: boolean; transactions?: Transaction[]; error?: string }> { try { const p = await getPage(); // Navigate to account details await p.goto(`${CHASE_BASE_URL}/web/auth/dashboard`, { waitUntil: "networkidle" }); await p.waitForTimeout(1000); // Click on the account const accountTile = await p.$(`[data-account-id="${accountId}"], .account-tile:nth-child(${parseInt(accountId.replace('account-', '')) + 1})`); if (accountTile) { await accountTile.click(); await p.waitForNavigation({ waitUntil: "networkidle" }).catch(() => {}); } await p.waitForTimeout(2000); const transactions = await p.$$eval( '.transaction-row, .activity-row, [data-testid="transaction"]', (elements, maxItems) => elements.slice(0, maxItems).map((el, index) => { const dateEl = el.querySelector('.transaction-date, .date, td:first-child'); const descEl = el.querySelector('.transaction-description, .description, .merchant-name'); const amountEl = el.querySelector('.transaction-amount, .amount'); const pendingEl = el.querySelector('.pending, .pending-badge'); const categoryEl = el.querySelector('.category, .transaction-category'); const amountText = amountEl?.textContent?.trim() || '0'; const amount = Math.abs(parseFloat(amountText.replace(/[$,]/g, ''))) || 0; const isCredit = amountText.includes('+') || el.classList.contains('credit'); return { id: el.getAttribute('data-transaction-id') || `txn-${index}`, date: dateEl?.textContent?.trim() || '', description: descEl?.textContent?.trim() || 'Unknown', amount, type: isCredit ? 'credit' : 'debit' as 'credit' | 'debit', category: categoryEl?.textContent?.trim() || undefined, pending: !!pendingEl, }; }), limit ); return { success: true, transactions }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : "Failed to get transactions", }; } } - src/browser.ts:28-37 (schema)Transaction interface type definition used as the return type for the getTransactions function - defines id, date, description, amount, type (credit/debit), category, pending, and merchant fields.
export interface Transaction { id: string; date: string; description: string; amount: number; type: "credit" | "debit"; category?: string; pending: boolean; merchant?: string; }