Skip to main content
Glama
vargahis

monarch-mcp

get_accounts

Retrieve all financial accounts from Monarch Money to view balances and manage personal finances.

Instructions

Get all financial accounts from Monarch Money.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The get_accounts tool handler function that retrieves all financial accounts from Monarch Money. It uses an async helper to call the MonarchMoney client's get_accounts() method, formats the response into a clean list with id, name, type, balance, institution, and is_active fields, and returns JSON.
    @mcp.tool()
    @_handle_mcp_errors("getting accounts")
    def get_accounts() -> str:
        """Get all financial accounts from Monarch Money."""
    
        async def _get_accounts():
            client = await get_monarch_client()
            return await client.get_accounts()
    
        accounts = run_async(_get_accounts())
    
        # Format accounts for display
        account_list = []
        for account in accounts.get("accounts", []):
            account_info = {
                "id": account.get("id"),
                "name": account.get("displayName") or account.get("name"),
                "type": (account.get("type") or {}).get("name"),
                "balance": account.get("currentBalance"),
                "institution": (account.get("institution") or {}).get("name"),
                "is_active": account.get("isActive")
                if "isActive" in account
                else not account.get("deactivatedAt"),
            }
            account_list.append(account_info)
    
        return json.dumps(account_list, indent=2, default=str)
  • Registration of the get_accounts tool with the MCP server using the @mcp.tool() decorator from FastMCP. The decorator automatically registers the function as an available tool.
    @mcp.tool()
    @_handle_mcp_errors("getting accounts")
  • The schema is implicit in the function signature and return formatting. The function takes no parameters and returns a JSON string containing a list of account objects with fields: id, name, type, balance, institution, and is_active. No formal validation is performed, but the output structure is consistent.
    def get_accounts() -> str:
        """Get all financial accounts from Monarch Money."""
    
        async def _get_accounts():
            client = await get_monarch_client()
            return await client.get_accounts()
    
        accounts = run_async(_get_accounts())
    
        # Format accounts for display
        account_list = []
        for account in accounts.get("accounts", []):
            account_info = {
                "id": account.get("id"),
                "name": account.get("displayName") or account.get("name"),
                "type": (account.get("type") or {}).get("name"),
                "balance": account.get("currentBalance"),
                "institution": (account.get("institution") or {}).get("name"),
                "is_active": account.get("isActive")
                if "isActive" in account
                else not account.get("deactivatedAt"),
            }
            account_list.append(account_info)
    
        return json.dumps(account_list, indent=2, default=str)
  • Error handling decorator that wraps the get_accounts tool to provide comprehensive exception handling. It catches RuntimeError, TransportServerError, TransportQueryError, TransportError, and generic exceptions, returning user-friendly error messages.
    def _handle_mcp_errors(operation: str):
        """Decorator providing granular exception handling for MCP tool functions.
    
        Catches specific known exception types with appropriate log messages,
        with a catch-all for anything unexpected.  Every path returns a
        user-readable error string so the MCP tool never crashes.
        """
        def decorator(func):
            @functools.wraps(func)
            def wrapper(*args, **kwargs):
                try:
                    return func(*args, **kwargs)
                except RuntimeError as exc:
                    logger.error("Runtime error %s: %s", operation, exc)
                    return f"Error {operation}: {exc}"
                except TransportServerError as exc:
                    code = getattr(exc, "code", "unknown")
                    logger.error(
                        "Monarch API HTTP %s error %s: %s", code, operation, exc,
                    )
                    return f"Error {operation}: Monarch API returned HTTP {code}: {exc}"
                except TransportQueryError as exc:
                    logger.error("Monarch API query error %s: %s", operation, exc)
                    return f"Error {operation}: API query failed: {exc}"
                except TransportError as exc:
                    logger.error(
                        "Monarch API connection error %s: %s", operation, exc,
                    )
                    return f"Error {operation}: connection error: {exc}"
                except Exception as exc:  # pylint: disable=broad-exception-caught
                    logger.error(
                        "Unexpected error %s: %s (%s)",
                        operation, exc, type(exc).__name__,
                    )
                    return f"Error {operation}: {exc}"
            return wrapper
        return decorator
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral information. It doesn't mention whether this returns all accounts at once or uses pagination, what data format to expect, authentication requirements, or rate limits. 'Get all' implies comprehensive retrieval but lacks operational details.

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 a single, efficient sentence that communicates the core functionality without unnecessary words. It's perfectly front-loaded with the essential information and contains zero wasted content.

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 parameterless tool with an output schema, the description covers the basic purpose adequately. However, without annotations and with many similar sibling tools, it should provide more context about scope, limitations, and differentiation from alternatives to be truly complete.

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

Parameters4/5

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

The tool has zero parameters with 100% schema description coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, focusing instead on the tool's purpose. A baseline of 4 is appropriate for parameterless tools.

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 action ('Get') and resource ('all financial accounts from Monarch Money'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_account_history' or 'get_account_holdings', which would require more specific scope definition.

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?

No guidance is provided about when to use this tool versus alternatives like 'get_account_snapshots_by_type' or 'get_recent_account_balances'. The description simply states what it does without context about appropriate use cases or limitations.

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/vargahis/monarch-mcp'

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