chase_auth_check
Verifies Chase login status and provides authentication instructions if needed. Use this before any other Chase operations to ensure access.
Instructions
Check if user is logged in to Chase. Returns login status and instructions if not authenticated. Call this before any other Chase operations.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:49-58 (registration)Tool registration for chase_auth_check in the ListTools handler: defines the tool name, description, and empty input schema (no params).
tools: [ { name: "chase_auth_check", description: "Check if user is logged in to Chase. Returns login status and instructions if not authenticated. Call this before any other Chase operations.", inputSchema: { type: "object", properties: {}, }, }, - src/index.ts:209-264 (handler)Handler case for 'chase_auth_check' in CallToolRequestSchema. Calls hasStoredCookies() from auth.ts and checkAuth()/getLoginUrl() from browser.ts to return login status, URL, and instructions.
case "chase_auth_check": { const hasCookies = hasStoredCookies(); if (!hasCookies) { const loginInfo = await getLoginUrl(); return { content: [ { type: "text", text: JSON.stringify({ success: true, isLoggedIn: false, message: "Not logged in to Chase.", loginUrl: loginInfo.url, instructions: loginInfo.instructions, cookiesPath: getCookiesPath(), }), }, ], }; } const authState = await checkAuth(); if (!authState.isLoggedIn) { const loginInfo = await getLoginUrl(); return { content: [ { type: "text", text: JSON.stringify({ success: true, isLoggedIn: false, message: "Session expired. Please log in again.", loginUrl: loginInfo.url, instructions: loginInfo.instructions, }), }, ], }; } return { content: [ { type: "text", text: JSON.stringify({ success: true, isLoggedIn: true, message: "Logged in to Chase.", accountHolder: authState.accountHolder, }), }, ], }; } - src/auth.ts:30-31 (helper)hasStoredCookies() helper: checks if the cookies file exists at ~/.strider/chase/cookies.json.
export function hasStoredCookies(): boolean { return fs.existsSync(COOKIES_PATH); - src/browser.ts:131-137 (helper)getLoginUrl() helper: returns the Chase login URL and instructions for cookie export.
export async function getLoginUrl(): Promise<{ url: string; instructions: string }> { return { url: "https://secure.chase.com/web/auth/dashboard", instructions: "Please log in to Chase in a browser, then export your cookies to ~/.strider/chase/cookies.json. Use a browser extension like 'Cookie-Editor' to export cookies in JSON format. Note: Chase uses MFA, so you may need to re-export cookies after each session.", }; } - src/browser.ts:142-167 (helper)checkAuth() helper: navigates to Chase dashboard, checks if redirected to login, and returns AuthState with isLoggedIn flag and accountHolder name.
export async function checkAuth(): Promise<AuthState> { try { const p = await getPage(); await p.goto(`${CHASE_BASE_URL}/web/auth/dashboard`, { waitUntil: "networkidle" }); // Check if we're on the dashboard or redirected to login const currentUrl = p.url(); if (currentUrl.includes("/auth/logon") || currentUrl.includes("/login")) { return { isLoggedIn: false }; } // Try to get account holder name const holderName = await p.$eval( '.mds-header-user-name, .account-holder-name, [data-testid="user-greeting"]', (el) => el.textContent?.trim() || "", ).catch(() => ""); return { isLoggedIn: true, accountHolder: holderName || undefined, }; } catch (error) { return { isLoggedIn: false }; } }