get_account_snapshots
Retrieve balance history for a specific account over a defined period to track financial changes and analyze account performance.
Instructions
Get balance history for a specific account over time
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountId | Yes | The ID of the account | |
| startDate | No | Start date in YYYY-MM-DD format | |
| endDate | No | End date in YYYY-MM-DD format |
Implementation Reference
- src/tools.ts:572-595 (handler)The main handler implementation for get_account_snapshots that calls the API and formats the response with success status, data, and summaryprivate async getAccountSnapshots( accountId: string, startDate?: string, endDate?: string ): Promise<any> { try { const snapshots = await this.api.getAccountSnapshots( accountId, startDate, endDate ); return { success: true, data: snapshots, summary: `Retrieved ${snapshots?.length || 0} account snapshots`, }; } catch (error) { throw new Error( `Failed to get account snapshots: ${ error instanceof Error ? error.message : 'Unknown error' }` ); }
- src/tools.ts:161-180 (registration)Tool registration including name, description, and input schema with accountId, startDate, and endDate parametersname: 'get_account_snapshots', description: 'Get balance history for a specific account over time', inputSchema: { type: 'object', properties: { accountId: { type: 'string', description: 'The ID of the account', }, startDate: { type: 'string', description: 'Start date in YYYY-MM-DD format', }, endDate: { type: 'string', description: 'End date in YYYY-MM-DD format', }, }, required: ['accountId'], },
- src/tools.ts:233-238 (registration)Switch case that routes the tool execution to the getAccountSnapshots handler with the provided argumentscase 'get_account_snapshots': return await this.getAccountSnapshots( args.accountId, args.startDate, args.endDate );
- src/monarch-api.ts:439-470 (helper)API helper method that constructs and executes the GraphQL query to fetch account snapshots from the Monarch Money APIasync getAccountSnapshots( accountId: string, startDate?: string, endDate?: string ): Promise<any[]> { let filters = `accountId: "${accountId}"`; if (startDate) { filters += `, startDate: "${startDate}"`; } if (endDate) { filters += `, endDate: "${endDate}"`; } const query = ` query GetAccountSnapshots { accountSnapshots(filters: {${filters}}) { date balance signedBalance } } `; try { const data: any = await this.graphQLClient.request(query); return data.accountSnapshots || []; } catch (error: any) { if ( error.message.includes('401') || error.message.includes('unauthorized') ) { throw new Error(