Skip to main content
Glama
whitebirchio

Monarch Money MCP Server

by whitebirchio

get_portfolio

Retrieve your current investment portfolio summary with holdings and performance data for specified date ranges using Monarch Money's financial integration.

Instructions

Get current investment portfolio summary, including holdings and performance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startDateNoStart date in YYYY-MM-DD format
endDateNoEnd date in YYYY-MM-DD format

Implementation Reference

  • The main handler function getPortfolio that executes the get_portfolio tool logic. It calls the API, processes the response, and returns a formatted result with success status and summary.
    private async getPortfolio(
      startDate?: string,
      endDate?: string
    ): Promise<any> {
      try {
        const portfolio = await this.api.getPortfolio(startDate, endDate);
    
        return {
          success: true,
          data: portfolio,
          summary: `Retrieved portfolio summary with ${
            portfolio?.aggregateHoldings?.edges?.length || 0
          } holdings`,
        };
      } catch (error) {
        throw new Error(
          `Failed to get portfolio: ${
            error instanceof Error ? error.message : 'Unknown error'
          }`
        );
      }
    }
  • src/tools.ts:182-200 (registration)
    Tool registration for 'get_portfolio' including name, description, and inputSchema with optional startDate and endDate parameters.
    {
      name: 'get_portfolio',
      description:
        'Get current investment portfolio summary, including holdings and performance',
      inputSchema: {
        type: 'object',
        properties: {
          startDate: {
            type: 'string',
            description: 'Start date in YYYY-MM-DD format',
          },
          endDate: {
            type: 'string',
            description: 'End date in YYYY-MM-DD format',
          },
        },
        required: [],
      },
    },
  • src/tools.ts:240-241 (registration)
    Switch case handler that routes 'get_portfolio' tool name to the getPortfolio method with arguments.
    case 'get_portfolio':
      return await this.getPortfolio(args.startDate, args.endDate);
  • Portfolio interface schema defining the return type structure with performance data, aggregate holdings, and nested objects.
    interface Portfolio {
      performance: {
        totalValue: number;
        totalBasis: number;
        totalChangePercent: number;
        totalChangeDollars: number;
        oneDayChangePercent: number;
        historicalChart: {
          date: string;
          returnPercent: number;
        }[];
        benchmarks: {
          security: {
            id: string;
            ticker: string;
            name: string;
            oneDayChangePercent: number;
          };
          historicalChart: {
            date: string;
            returnPercent: number;
          }[];
        }[];
      };
      aggregateHoldings: {
        edges: {
          node: {
            id: string;
            quantity: number;
            basis: number;
            totalValue: number;
            securityPriceChangeDollars: number | null;
            securityPriceChangePercent: number | null;
            lastSyncedAt: string | null;
            holdings: {
              id: string;
              type: string;
              typeDisplay: string;
              name: string;
              ticker: string | null;
              closingPrice: number | null;
              closingPriceUpdatedAt: string | null;
              quantity: number;
              value: number;
              account: Account;
            }[];
            security: {
              id: string;
              name: string;
              ticker: string | null;
              currentPrice: number | null;
              currentPriceUpdatedAt: string | null;
              closingPrice: number | null;
              type: string;
              typeDisplay: string;
            };
          };
        }[];
      };
    }
  • API layer getPortfolio method that constructs and executes the GraphQL query to fetch portfolio data from Monarch Money.
    async getPortfolio(startDate?: string, endDate?: string): Promise<Portfolio> {
      const query = `
        query GetPortfolio($portfolioInput: PortfolioInput) {
          portfolio(input: $portfolioInput) {
            performance {
              totalValue
              totalBasis
              totalChangePercent
              totalChangeDollars
              oneDayChangePercent
              historicalChart {
                date
                returnPercent
                __typename
              }
              benchmarks {
                security {
                  id
                  ticker
                  name
                  oneDayChangePercent
                  __typename
                }
                historicalChart {
                  date
                  returnPercent
                  __typename
                }
                __typename
              }
              __typename
            }
            aggregateHoldings {
              edges {
                node {
                  id
                  quantity
                  basis
                  totalValue
                  securityPriceChangeDollars
                  securityPriceChangePercent
                  lastSyncedAt
                  holdings {
                    id
                    type
                    typeDisplay
                    name
                    ticker
                    closingPrice
                    closingPriceUpdatedAt
                    quantity
                    value
                    account {
                      id
                      mask
                      icon
                      logoUrl
                      institution {
                        id
                        name
                        __typename
                      }
                      type {
                        name
                        display
                        __typename
                      }
                      subtype {
                        name
                        display
                        __typename
                      }
                      displayName
                      currentBalance
                      __typename
                    }
                    __typename
                  }
                  security {
                    id
                    name
                    ticker
                    currentPrice
                    currentPriceUpdatedAt
                    closingPrice
                    type
                    typeDisplay
                    __typename
                  }
                  __typename
                }
                __typename
              }
              __typename
            }
            __typename
          }
        }
      `;
    
      try {
        const data: any = await this.graphQLClient.request(query, {
          portfolioInput: { startDate, endDate },
        });
        return data.portfolio;
      } 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 portfolio: ${error.message}`);
      }
    }
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 this is a 'Get' operation, implying read-only behavior, but doesn't mention authentication requirements, rate limits, data freshness, or what happens if date parameters are omitted (since they're optional). The description adds minimal context beyond the basic operation.

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 with a single sentence that efficiently communicates the core functionality. Every word earns its place - 'Get' specifies the action, 'current investment portfolio summary' defines the resource, and 'including holdings and performance' clarifies the return content. No wasted words or redundant information.

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

Completeness3/5

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

For a read-only tool with 2 optional parameters and 100% schema coverage, the description provides adequate basic information about what the tool returns. However, with no annotations and no output schema, it doesn't describe the structure of the returned portfolio summary, performance metrics format, or how date filtering works when parameters are omitted. The description is minimally complete but lacks depth for a financial data tool.

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 both parameters (startDate and endDate) with their formats. The description doesn't add any parameter-specific information beyond what's in the schema, nor does it explain how these optional parameters affect the returned portfolio summary. This meets the baseline for high schema coverage.

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 tool's purpose with a specific verb ('Get') and resource ('current investment portfolio summary'), including what information it returns ('holdings and performance'). It distinguishes this from sibling tools like get_account_balance or get_transactions by focusing on portfolio-level data rather than account balances or transaction details.

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. While it implies this is for portfolio-level data, it doesn't explicitly state when to choose get_portfolio over similar tools like get_net_worth or get_account_snapshots, nor does it mention any prerequisites or exclusions for usage.

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