Skip to main content
Glama
whitebirchio

Monarch Money MCP Server

by whitebirchio

get_transactions

Retrieve recent financial transactions from Monarch Money, with optional filters for specific accounts, date ranges, or transaction amounts to analyze spending patterns.

Instructions

Get recent transactions, optionally filtered by account, date range, or amount

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdNoOptional: Filter by specific account ID
limitNoNumber of transactions to retrieve (default: 50, max: 500)
startDateNoStart date in YYYY-MM-DD format
endDateNoEnd date in YYYY-MM-DD format

Implementation Reference

  • Main handler implementation for get_transactions tool. Processes arguments (limit, accountId, startDate, endDate), calls the API method, and returns formatted response with success status, data, and summary.
    private async getTransactions(args: any): Promise<any> {
      try {
        const limit = Math.min(args.limit || 50, 500);
        const options: any = { limit };
    
        if (args.accountId) {
          options.accountId = args.accountId;
        }
        if (args.startDate) {
          options.startDate = args.startDate;
        }
        if (args.endDate) {
          options.endDate = args.endDate;
        }
    
        const transactions = await this.api.getTransactions(options);
    
        return {
          success: true,
          data: transactions,
          summary: `Retrieved ${transactions?.length || 0} transactions`,
        };
      } catch (error) {
        throw new Error(
          `Failed to get transactions: ${
            error instanceof Error ? error.message : 'Unknown error'
          }`
        );
      }
    }
  • src/tools.ts:212-213 (registration)
    Tool registration in executeTool switch statement that routes 'get_transactions' tool name to the getTransactions handler method.
    case 'get_transactions':
      return await this.getTransactions(args);
  • Tool schema definition including name, description, and inputSchema with properties for optional accountId, limit, startDate, and endDate parameters.
    name: 'get_transactions',
    description:
      'Get recent transactions, optionally filtered by account, date range, or amount',
    inputSchema: {
      type: 'object',
      properties: {
        accountId: {
          type: 'string',
          description: 'Optional: Filter by specific account ID',
        },
        limit: {
          type: 'number',
          description:
            'Number of transactions to retrieve (default: 50, max: 500)',
          default: 50,
        },
        startDate: {
          type: 'string',
          description: 'Start date in YYYY-MM-DD format',
        },
        endDate: {
          type: 'string',
          description: 'End date in YYYY-MM-DD format',
        },
      },
      required: [],
    },
  • Underlying API method that executes GraphQL query to fetch transactions from Monarch Money API. Constructs query with filters and handles authentication errors.
    async getTransactions(
      options: {
        limit?: number;
        accountId?: string;
        startDate?: string;
        endDate?: string;
        offset?: number;
      } = {}
    ): Promise<Transaction[]> {
      const { limit = 100, accountId, startDate, endDate, offset = 0 } = options;
    
      const query = `
        query GetTransactionsList($offset: Int, $limit: Int, $filters: TransactionFilterInput, $orderBy: TransactionOrdering) {
          allTransactions(filters: $filters) {
            totalCount
            results(offset: $offset, limit: $limit, orderBy: $orderBy) {
              id
              amount
              pending
              date
              plaidName
              notes
              category {
                id
                name
                __typename
              }
              merchant {
                name
                id
                __typename
              }
              account {
                id
                displayName
              }
              __typename
            }
            __typename
          }
        }
      `;
    
      const variables: any = {
        offset,
        limit,
        filters: {},
        orderBy: 'date',
      };
    
      if (accountId) variables.filters.accountId = accountId;
      if (startDate) variables.filters.startDate = startDate;
      if (endDate) variables.filters.endDate = endDate;
    
      try {
        const data: any = await this.graphQLClient.request(query, variables);
        return data.allTransactions?.results || [];
      } catch (error: any) {
        if (
          error.message.includes('401') ||
          error.message.includes('unauthorized')
        ) {
          throw new Error(
            'Authentication failed. Please check your MONARCH_TOKEN environment variable.'
          );
        }
        throw new Error(`Failed to get transactions: ${error.message}`);
      }
    }
  • Transaction interface defining the data structure returned by the get_transactions tool, including id, amount, date, category, merchant, and account information.
    export interface Transaction {
      id: string;
      amount: number;
      date: string;
      plaidName?: string;
      notes?: string;
      pending?: boolean;
      category?: {
        id: string;
        name: string;
      };
      merchant?: {
        id: string;
        name: string;
      };
      account: {
        id: string;
        displayName: string;
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves transactions with optional filters but doesn't mention important behavioral aspects like whether this is a read-only operation, pagination behavior, rate limits, authentication requirements, or what 'recent' means in terms of time frame. The description is too minimal for a tool with filtering capabilities.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single sentence that efficiently communicates the core functionality. Every word earns its place, with no redundant information or unnecessary elaboration. The structure is front-loaded with the main purpose followed by filtering options.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 4 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'recent' means, doesn't mention the 'limit' parameter that appears in the schema, and provides no information about return format, error conditions, or how this differs from 'search_transactions'. The description leaves too many contextual gaps for effective tool selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 4 parameters thoroughly. The description mentions filtering by account, date range, or amount (though 'amount' isn't in the schema), adding minimal value beyond what's in the structured data. It doesn't explain parameter interactions or provide usage examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('recent transactions'), making the purpose immediately understandable. It distinguishes from some siblings like 'get_account_balance' or 'get_categories' by focusing on transactions, though it doesn't explicitly differentiate from 'search_transactions' which appears to be a more comprehensive search tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'search_transactions' or other sibling tools. It mentions optional filtering capabilities but doesn't specify scenarios where this tool is preferred over others, leaving the agent to guess based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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