Skip to main content
Glama
WGDevelopment

YNAB MCP Server

ynab_get_categories

Read-onlyIdempotent

Get a complete list of category groups and categories with their budgeted amounts and balances from a YNAB budget. Specify a budget ID or default to the last-used budget.

Instructions

List all category groups and categories with budgeted amounts and balances.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler function that lists all categories in a budget. It calls client.get_categories(), formats the output as a markdown table with budgeted/spent/available columns, and skips hidden/deleted/internal categories.
    @mcp.tool(
        name="ynab_get_categories",
        annotations={
            "title": "List Categories",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": False,
        }
    )
    async def ynab_get_categories(params: GetCategoriesInput) -> str:
        """List all category groups and categories with budgeted amounts and balances."""
        try:
            async with YNABClient() as client:
                category_groups = await client.get_categories(params.budget_id)
            
            result = "## Budget Categories\n\n"
            
            for group in category_groups:
                if group.get("hidden") or group.get("deleted"):
                    continue
                if group["name"] in ["Internal Master Category", "Credit Card Payments"]:
                    continue
                    
                result += f"### {group['name']}\n\n"
                result += "| Category | Budgeted | Spent | Available |\n"
                result += "|----------|----------|-------|----------|\n"
                
                for cat in group.get("categories", []):
                    if cat.get("hidden") or cat.get("deleted"):
                        continue
                        
                    budgeted = format_currency(cat.get("budgeted", 0))
                    activity = format_currency(cat.get("activity", 0))
                    balance = format_currency(cat.get("balance", 0))
                    
                    result += f"| {cat['name']} | {budgeted} | {activity} | {balance} |\n"
                    result += f"| ↳ ID: `{cat['id']}` | | | |\n"
                
                result += "\n"
            
            return result
        except Exception as e:
            return format_error(e)
  • Pydantic input model for ynab_get_categories. Inherits from BudgetIdInput which provides a budget_id field (default 'last-used').
    class GetCategoriesInput(BudgetIdInput):
        """Input for listing all categories in a budget."""
        pass
  • The @mcp.tool decorator registering 'ynab_get_categories' with FastMCP, including annotations for readOnlyHint, destructiveHint, idempotentHint, and openWorldHint.
    @mcp.tool(
        name="ynab_get_categories",
        annotations={
            "title": "List Categories",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": False,
        }
    )
  • The API client method that makes the actual HTTP GET request to YNAB's /budgets/{budget_id}/categories endpoint and returns category groups.
    async def get_categories(self, budget_id: str) -> List[Dict[str, Any]]:
        """Get all category groups and categories for a budget."""
        response = await self._request("GET", f"/budgets/{budget_id}/categories")
        return response["data"]["category_groups"]
Behavior3/5

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

Annotations already declare readOnlyHint, destructiveHint, and idempotentHint, so the tool's safety profile is clear. The description adds value by specifying that output includes 'budgeted amounts and balances', but no other behavioral traits are disclosed.

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?

A single sentence that efficiently conveys the entire purpose with no redundant or extraneous information.

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

Completeness4/5

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

For a simple read-only list tool with an output schema present, the description provides sufficient context. It does not delve into details about nested groups, but the output schema handles that.

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?

The input schema already provides a detailed description for the single parameter budget_id, including the 'last-used' default. The tool description does not add additional parameter semantics.

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

Purpose5/5

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

Description clearly states the verb 'List' and the resource 'category groups and categories', and specifies included data 'budgeted amounts and balances'. This distinguishes it from sibling tools like ynab_get_accounts.

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 explicit guidance on when to use this tool versus alternatives. The description only states functionality without providing context or exclusions.

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/WGDevelopment/ynab-mcp-server'

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