Skip to main content
Glama
whitebirchio

Monarch Money MCP Server

by whitebirchio

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
NameRequiredDescriptionDefault
accountIdYesThe ID of the account
startDateNoStart date in YYYY-MM-DD format
endDateNoEnd date in YYYY-MM-DD format

Implementation Reference

  • The main handler implementation for get_account_snapshots that calls the API and formats the response with success status, data, and summary
    private 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 parameters
    name: '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 arguments
    case 'get_account_snapshots':
      return await this.getAccountSnapshots(
        args.accountId,
        args.startDate,
        args.endDate
      );
  • API helper method that constructs and executes the GraphQL query to fetch account snapshots from the Monarch Money API
    async 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(

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/whitebirchio/monarch-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server