Skip to main content
Glama
Meh-S-Eze

MCP YNAB Server

get_categories

Retrieve and list all transaction categories for a specified YNAB budget in Markdown format, enabling easy organization and reference.

Instructions

List all transaction categories for a given YNAB budget in Markdown format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idYes

Implementation Reference

  • The primary handler for the 'get_categories' MCP tool. It is decorated with @mcp.tool(), fetches category groups from the YNAB API using CategoriesApi, processes the data with helper functions, builds Markdown tables for each category group, and returns the formatted string.
    @mcp.tool()
    async def get_categories(budget_id: str) -> str:
        """List all transaction categories for a given YNAB budget in Markdown format."""
        async with await get_ynab_client() as client:
            categories_api = CategoriesApi(client)
            response = categories_api.get_categories(budget_id)
            groups = response.data.category_groups
    
            markdown = "# YNAB Categories\n\n"
            headers = ["Category ID", "Category Name", "Budgeted", "Activity"]
            align = ["left", "left", "right", "right"]
    
            for group in groups:
                if isinstance(group, CategoryGroupWithCategories):
                    categories_list = group.categories
                    group_name = group.name
                else:
                    group_dict = cast(Dict[str, Any], group.to_dict())
                    categories_list = group_dict["categories"]
                    group_name = group_dict["name"]
    
                if not categories_list:
                    continue
    
                markdown += f"## {group_name}\n\n"
                rows = []
    
                for category in categories_list:
                    cat_id, name, budgeted, activity = _process_category_data(category)
                    budgeted_dollars = float(budgeted) / 1000 if budgeted else 0
                    activity_dollars = float(activity) / 1000 if activity else 0
    
                    rows.append(
                        [
                            cat_id,
                            name,
                            _format_dollar_amount(budgeted_dollars),
                            _format_dollar_amount(activity_dollars),
                        ]
                    )
    
                table_md = _build_markdown_table(rows, headers, align)
                markdown += table_md + "\n"
            return markdown
  • Helper function used exclusively in get_categories to extract and standardize category information (ID, name, budgeted amount, activity) from either Category objects or dictionaries.
    def _process_category_data(category: Category | Dict[str, Any]) -> tuple[str, str, float, float]:
        """Process category data and return tuple of (id, name, budgeted, activity)."""
        if isinstance(category, Category):
            return category.id, category.name, category.budgeted, category.activity
        cat_dict = cast(Dict[str, Any], category)
        return cat_dict["id"], cat_dict["name"], cat_dict["budgeted"], cat_dict["activity"]
  • Helper function used in get_categories to format dollar amounts (converting from dollars, adding $ sign, commas, and negative sign if applicable).
    def _format_dollar_amount(amount: float) -> str:
        """Format a dollar amount with proper sign and formatting."""
        amount_str = f"${abs(amount):,.2f}"
        return f"-{amount_str}" if amount < 0 else amount_str
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 lists categories in Markdown format, which implies a read-only operation, but doesn't cover critical aspects like authentication needs, rate limits, error handling, or whether it's idempotent. For a tool with zero annotation coverage, this is insufficient.

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 with zero waste—it front-loads the purpose and includes key details like scope and output format without redundancy. Every word earns its place, making it highly concise and well-structured.

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?

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is minimally complete. It covers the basic operation and output format but lacks details on behavioral traits, parameter usage, and sibling differentiation, which are needed for full agent understanding in this context.

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 description adds minimal semantics beyond the input schema, which has 0% description coverage. It implies the budget_id parameter is required to specify the YNAB budget, but doesn't explain its format, source, or validation. With one parameter and low schema coverage, the description provides basic context but doesn't fully compensate for the lack of schema details.

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 ('List') and resource ('transaction categories'), specifying the scope ('for a given YNAB budget') and output format ('in Markdown format'). It distinguishes from siblings like get_transactions or get_accounts by focusing on categories, though it doesn't explicitly contrast with cache_categories, which might be a related operation.

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 on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a valid budget_id), exclusions, or comparisons to siblings like cache_categories or get_budgets, leaving the agent to infer usage context.

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