Skip to main content
Glama
Meh-S-Eze

MCP YNAB Server

get_accounts

Retrieve and display all accounts within a specific YNAB budget in Markdown format. This tool helps users quickly view and organize their financial accounts for better budgeting clarity.

Instructions

List all YNAB accounts in a specific budget in Markdown format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idYes

Implementation Reference

  • The primary handler function for the 'get_accounts' tool. It takes a budget_id, fetches accounts using the YNAB AccountsApi, formats the output using _format_accounts_output, builds a Markdown summary with grouped accounts, totals, and tables.
    @mcp.tool()
    async def get_accounts(budget_id: str) -> str:
        """List all YNAB accounts in a specific budget in Markdown format."""
        async with await get_ynab_client() as client:
            accounts_api = AccountsApi(client)
            all_accounts: List[Dict[str, Any]] = []
            response = accounts_api.get_accounts(budget_id)
            for account in response.data.accounts:
                if isinstance(account, Account):
                    all_accounts.append(account.to_dict())
    
            formatted = _format_accounts_output(all_accounts)
    
            markdown = "# YNAB Account Summary\n\n"
            markdown += "## Summary\n"
            markdown += f"- **Total Assets:** {formatted['summary']['total_assets']}\n"
            markdown += f"- **Total Liabilities:** {formatted['summary']['total_liabilities']}\n"
            markdown += f"- **Net Worth:** {formatted['summary']['net_worth']}\n\n"
    
            for group in formatted["accounts"]:
                markdown += f"## {group['type']}\n"
                markdown += f"**Group Total:** {group['total']}\n\n"
    
                rows = []
                for acct in group["accounts"]:
                    rows.append([acct["name"], acct["balance"], acct["id"]])
    
                markdown += _build_markdown_table(
                    rows, ["Account Name", "Balance", "ID"], ["left", "right", "left"]
                )
                markdown += "\n"
    
            return markdown
  • Helper function _format_accounts_output that processes account data: groups by type (checking, savings, etc.), calculates balances in dollars, sorts by balance, computes assets/liabilities/net worth summary, excludes closed/deleted accounts.
    def _format_accounts_output(accounts: List[Dict[str, Any]]) -> Dict[str, Any]:
        """Format account data into a user-friendly structure."""
        account_groups: Dict[str, List[Dict[str, Any]]] = {}
        type_order = [
            "checking",
            "savings",
            "creditCard",
            "mortgage",
            "autoLoan",
            "studentLoan",
            "otherAsset",
            "otherLiability",
        ]
    
        type_display_names = {
            "checking": "Checking Accounts",
            "savings": "Savings Accounts",
            "creditCard": "Credit Cards",
            "mortgage": "Mortgages",
            "autoLoan": "Auto Loans",
            "studentLoan": "Student Loans",
            "otherAsset": "Other Assets",
            "otherLiability": "Other Liabilities",
        }
    
        for account in accounts:
            if account.get("closed", False) or account.get("deleted", False):
                continue
    
            acct_type = account["type"]
            if acct_type not in account_groups:
                account_groups[acct_type] = []
    
            balance = float(account["balance"]) / 1000
            account_groups[acct_type].append(
                {
                    "name": account["name"],
                    "balance": f"${balance:,.2f}",
                    "balance_raw": balance,
                    "id": account["id"],
                }
            )
    
        for group in account_groups.values():
            group.sort(key=lambda x: abs(x["balance_raw"]), reverse=True)
    
        output: Dict[str, Any] = {
            "accounts": [],
            "summary": {
                "total_assets": 0.0,
                "total_liabilities": 0.0,
                "net_worth": 0.0,
            },
        }
    
        for acct_type in type_order:
            if acct_type in account_groups and account_groups[acct_type]:
                group_data = {
                    "type": type_display_names.get(acct_type, acct_type),
                    "accounts": account_groups[acct_type],
                }
                group_total = sum(acct["balance_raw"] for acct in account_groups[acct_type])
                group_data["total"] = f"${group_total:,.2f}"
    
                if acct_type in ["checking", "savings", "otherAsset"]:
                    output["summary"]["total_assets"] += group_total
                elif acct_type in [
                    "creditCard",
                    "mortgage",
                    "autoLoan",
                    "studentLoan",
                    "otherLiability",
                ]:
                    output["summary"]["total_liabilities"] += abs(group_total)
    
                output["accounts"].append(group_data)
    
        output["summary"]["net_worth_raw"] = (
            output["summary"]["total_assets"] - output["summary"]["total_liabilities"]
        )
        output["summary"]["total_assets"] = f"${output['summary']['total_assets']:,.2f}"
        output["summary"]["total_liabilities"] = f"${output['summary']['total_liabilities']:,.2f}"
        output["summary"]["net_worth"] = f"${output['summary']['net_worth_raw']:,.2f}"
    
        return output
  • The @mcp.tool() decorator registers the get_accounts function as an MCP tool.
    @mcp.tool()
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 mentions the output format ('Markdown format'), which adds some context beyond basic listing. However, it fails to disclose critical traits like whether this is a read-only operation, potential rate limits, authentication needs, error handling, or pagination behavior for large account lists. The description is too sparse for a tool with zero annotation coverage.

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 front-loads the core action and resource. Every word earns its place, with no redundant or vague phrasing. It's appropriately sized for a simple list tool, making it easy to parse quickly.

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?

Given the tool's simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It lacks details on return values (beyond 'Markdown format'), error cases, or operational constraints. For a tool with zero annotation coverage, more context is needed to ensure the agent can invoke it correctly without guesswork.

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

Parameters2/5

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

The input schema has 1 parameter with 0% description coverage, so the description must compensate. It adds meaning by specifying 'in a specific budget', which clarifies the 'budget_id' parameter's purpose. However, it doesn't explain the parameter's format, constraints, or how to obtain valid budget IDs, leaving significant gaps in understanding how to use the tool effectively.

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 ('List all') and resource ('YNAB accounts in a specific budget'), making the purpose evident. It distinguishes from siblings like 'get_account_balance' by focusing on listing rather than retrieving a specific metric. However, it doesn't explicitly differentiate from 'get_budgets' or 'get_transactions', which are also list operations but for different resources.

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 minimal guidance by specifying 'in a specific budget', implying it should be used when targeting accounts within a budget context. However, it lacks explicit when-to-use criteria, prerequisites (e.g., budget must exist), or alternatives (e.g., when to use 'get_account_balance' instead). No exclusions or comparisons to sibling tools are mentioned.

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

Related 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/Meh-S-Eze/ynab-mcp-client2'

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