Skip to main content
Glama
Jtewen

You Need A Budget (YNAB) MCP

by Jtewen

list-categories

Retrieve all categories, groups, and budgeting details for a specific budget to review available funds and allocated amounts before adjusting budgets.

Instructions

List all categories, groups, and their budgeting details for a given budget. Call this before managing budgeted amounts to see what's available and what's already been allocated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idNoThe ID of the budget. If not provided, the default budget will be used.

Implementation Reference

  • The main handler function for the 'list-categories' tool within the handle_call_tool method. It validates input, fetches category groups using ynab_client, and formats a detailed text response with category budgets, spending, balances, and goals.
    elif name == "list-categories":
        args = ListCategoriesInput.model_validate(arguments or {})
        budget_id = await _get_budget_id(args.model_dump())
        category_groups = await ynab_client.get_categories(budget_id=budget_id)
    
        if not category_groups:
            return [types.TextContent(type="text", text="No categories found for this budget.")]
    
        output = "Here are the available categories and their status for the current month:\n"
        for group in category_groups:
            if not group.hidden and group.categories:
                output += f"\n--- {group.name} ---\n"
                for cat in group.categories:
                    if not cat.hidden:
                        details = (
                            f"Budgeted: {cat.budgeted / 1000:.2f}, "
                            f"Spent: {abs(cat.activity) / 1000:.2f}, "
                            f"Balance: {cat.balance / 1000:.2f}"
                        )
                        output += f"- {cat.name} (ID: {cat.id})\n  - {details}\n"
                        if cat.goal_type:
                            goal_progress = f"{cat.goal_percentage_complete or 0}%"
                            goal_target = (
                                f"{cat.goal_target / 1000:.2f}" 
                                if cat.goal_target else "N/A"
                            )
                            output += (
                                f"  - Goal ({cat.goal_type}): Target {goal_target}, "
                                f"{goal_progress} complete\n"
                            )
        return [types.TextContent(type="text", text=output)]
  • Pydantic model defining the input schema for the 'list-categories' tool, inheriting from BudgetIdInput which provides an optional budget_id field.
    class ListCategoriesInput(BudgetIdInput):
        pass
  • Tool registration in the list_tools handler, defining name, description, and input schema for 'list-categories'.
    types.Tool(
        name="list-categories",
        description=(
            "List all categories, groups, and their budgeting details for a given budget. "
            "Call this before managing budgeted amounts to see what's available and what's already been allocated."
        ),
        inputSchema=ListCategoriesInput.model_json_schema(),
    ),
  • Helper method in YNABClient that fetches category groups from the YNAB API, used by the list-categories handler.
        self, budget_id: str
    ) -> list[ynab.CategoryGroupWithCategories]:
        response = await self._run_sync(self._categories_api.get_categories, budget_id)
        return response.data.category_groups
  • Includes 'list-categories' in the set of read-only tools, restricting write operations in read-only mode.
    READ_ONLY_TOOLS = {
        "list-budgets",
        "list-accounts",
        "list-transactions",
        "list-categories",
        "list-payees",
        "list-scheduled-transactions",
        "get-financial-overview",
        "get-month-info",
        "lookup-payee-locations",
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It implies a read-only operation ('List') and mentions the purpose of viewing available and allocated details, but lacks specifics on permissions, rate limits, pagination, or error handling. For a tool with no annotations, this is a moderate gap in behavioral disclosure.

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 two sentences, front-loaded with the core purpose and followed by usage guidance. Every word earns its place, with no redundancy or fluff, making it highly efficient and easy to parse.

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?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is reasonably complete. It covers purpose, usage, and workflow context, though it could benefit from more behavioral details (e.g., response format, error cases) to fully compensate for the lack of annotations and output schema.

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?

Schema description coverage is 100%, so the schema already documents the single parameter 'budget_id' with its default behavior. The description adds no additional parameter semantics beyond what the schema provides, but with only one parameter and high coverage, the baseline is appropriately met without needing extra details.

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?

The description clearly states the specific action ('List all categories, groups, and their budgeting details') and resource ('for a given budget'), distinguishing it from siblings like 'list-budgets' or 'list-transactions' by focusing on categories and budgeting details. It explicitly mentions what information is returned (categories, groups, budgeting details).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool ('Call this before managing budgeted amounts') and why ('to see what's available and what's already been allocated'), directly contrasting with the sibling tool 'manage-budgeted-amount' for subsequent actions. It clearly establishes the tool's role in the workflow.

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

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