Skip to main content
Glama
WGDevelopment

YNAB MCP Server

ynab_move_money

Move money between YNAB categories: enter source and destination category IDs, the dollar amount to transfer, and an optional month for backdated changes.

Instructions

Move money from one category to another.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'ynab_move_money' tool. It moves money (in dollars) from one YNAB category to another by fetching both categories, validating sufficient budgeted funds, then updating both category budgets via the API. Returns a summary table with before/after amounts.
    async def ynab_move_money(params: MoveMoneyCategoryInput) -> str:
        """Move money from one category to another."""
        try:
            month = params.month or get_current_month()
            amount_milliunits = dollars_to_milliunits(params.amount)
            
            async with YNABClient() as client:
                from_cat = await client.get_category(params.budget_id, params.from_category_id)
                to_cat = await client.get_category(params.budget_id, params.to_category_id)
                
                from_budgeted = from_cat.get("budgeted", 0)
                to_budgeted = to_cat.get("budgeted", 0)
                
                if from_budgeted < amount_milliunits:
                    return (
                        f"Error: {from_cat['name']} only has {format_currency(from_budgeted)} budgeted. "
                        f"Cannot move {format_currency(amount_milliunits)}."
                    )
                
                new_from = from_budgeted - amount_milliunits
                new_to = to_budgeted + amount_milliunits
    
                await client.update_category_budget(
                    params.budget_id, params.from_category_id, month, new_from
                )
                await client.update_category_budget(
                    params.budget_id, params.to_category_id, month, new_to
                )
            
            result = f"## Money Moved Successfully\n\n"
            result += f"**Moved {format_currency(amount_milliunits)}** from {from_cat['name']} to {to_cat['name']}\n\n"
            result += f"| Category | Before | After |\n"
            result += f"|----------|--------|-------|\n"
            result += f"| {from_cat['name']} | {format_currency(from_budgeted)} | {format_currency(new_from)} |\n"
            result += f"| {to_cat['name']} | {format_currency(to_budgeted)} | {format_currency(new_to)} |\n"
            
            return result
        except Exception as e:
            return format_error(e)
  • Pydantic input schema 'MoveMoneyCategoryInput' defining the required fields: from_category_id, to_category_id, amount (in dollars, >0), and optional month (YYYY-MM-01 format). Inherits budget_id from BudgetIdInput.
    class MoveMoneyCategoryInput(BudgetIdInput):
        """Input for moving money between categories."""
        from_category_id: str = Field(..., description="Category ID to move money FROM")
        to_category_id: str = Field(..., description="Category ID to move money TO")
        amount: float = Field(..., description="Amount in dollars to move (e.g., 50.00)", gt=0)
        month: Optional[str] = Field(
            default=None,
            description="Month in YYYY-MM-DD format (first of month). Defaults to current month.",
            pattern=r"^\d{4}-\d{2}-01$",
        )
  • Registration of the tool via the @mcp.tool decorator with name='ynab_move_money', title 'Move Money Between Categories', with idempotentHint=False, destructiveHint=False, readOnlyHint=False.
    @mcp.tool(
        name="ynab_move_money",
        annotations={
            "title": "Move Money Between Categories",
            "readOnlyHint": False,
            "destructiveHint": False,
            "idempotentHint": False,
            "openWorldHint": False,
        }
    )
  • Helper function 'dollars_to_milliunits' used by the handler to convert dollar amounts to YNAB's internal milliunit integer format (1000 milliunits = $1.00).
    def dollars_to_milliunits(dollars: float) -> int:
        """Convert dollars to YNAB milliunits (1000 milliunits = $1.00)."""
        return int(round(dollars * 1000))
  • The API helper 'update_category_budget' that sends the PATCH request to YNAB's API to update a category's budgeted amount for a specific month. Used by the handler to apply the money movement.
    async def update_category_budget(
        self, 
        budget_id: str, 
        category_id: str, 
        month: str,
        budgeted: int,
    ) -> Dict[str, Any]:
        """Update the budgeted amount for a category in a specific month."""
        response = await self._request(
            "PATCH",
            f"/budgets/{budget_id}/months/{month}/categories/{category_id}",
            data={"category": {"budgeted": budgeted}},
        )
        return response["data"]["category"]
Behavior3/5

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

Annotations already indicate readOnlyHint=false and destructiveHint=false. The description adds no further behavioral details (e.g., side effects, required permissions).

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, concise sentence with no unnecessary words. Front-loaded and efficient.

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?

While the description states the core action, it omits context like output format, prerequisites (budget_id), and relationship to other tools. Output schema exists, reducing need for return description, but overall it's minimal.

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 has full parameter descriptions for all five parameters. The description adds no additional meaning beyond the schema, so baseline 3 is appropriate.

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 'Move money from one category to another' clearly states the verb (move) and resource (money between categories), distinguishing it from sibling tools like ynab_create_transaction which creates transactions.

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 on when to use this tool versus alternatives, nor when not to use it. No mention of prerequisites or 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

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