Skip to main content
Glama
Meh-S-Eze

MCP YNAB Server

create_transaction

Add a new transaction in YNAB by specifying account ID, amount, payee, and optional details like category and memo using the MCP YNAB Server.

Instructions

Create a new transaction in YNAB.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYes
amountYesAmount in dollars
category_nameNo
memoNo
payee_nameYes

Implementation Reference

  • The main handler function for the 'create_transaction' tool. It is decorated with @mcp.tool() which registers it and defines the schema from type annotations. Creates a new transaction in YNAB using the TransactionsApi.
    @mcp.tool()
    async def create_transaction(
        account_id: str,
        amount: Annotated[float, Field(description="Amount in dollars")],
        payee_name: str,
        category_name: Optional[str] = None,
        memo: Optional[str] = None,
    ) -> Dict[str, Any]:
        """Create a new transaction in YNAB."""
        async with await get_ynab_client() as client:
            transactions_api = TransactionsApi(client)
            budgets_api = BudgetsApi(client)
    
            amount_milliunits = int(amount * 1000)
    
            # Use preferred budget ID if available, otherwise fetch a list of budgets
            budget_id = ynab_resources.get_preferred_budget_id()
            if not budget_id:
                budgets_response = budgets_api.get_budgets()
                budget_id = budgets_response.data.budgets[0].id
    
            category_id = None
            if category_name:
                category_id = await _find_category_id(client, budget_id, category_name)
    
            # Create transaction data
            transaction = NewTransaction(
                account_id=account_id,
                date=date.today(),
                amount=amount_milliunits,
                payee_name=payee_name,
                memo=memo,
                category_id=category_id,
            )
    
            wrapper = PostTransactionsWrapper(transaction=transaction)
            response = transactions_api.create_transaction(budget_id, wrapper)
            if response.data and response.data.transaction:
                return response.data.transaction.to_dict()
            return {}
  • Helper utility function used by create_transaction to resolve category_name to a category_id by searching through category groups.
    async def _find_category_id(client: ApiClient, budget_id: str, category_name: str) -> Optional[str]:
        """Find a category ID by name."""
        categories_api = CategoriesApi(client)
        categories_response = categories_api.get_categories(budget_id)
        categories = categories_response.data.category_groups
        for group in categories:
            for cat in group.categories:
                if cat.name.lower() == category_name.lower():
                    return cat.id
        return None
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Create' implies a write/mutation operation, but the description doesn't mention permission requirements, whether transactions are immediately posted or pending, error conditions, or what happens on success. This leaves significant behavioral gaps for a tool that modifies financial data.

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 perfectly concise - a single sentence that states the core purpose without any wasted words. It's front-loaded with the essential information and earns its place efficiently.

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?

For a mutation tool with 5 parameters, no annotations, no output schema, and only 20% schema description coverage, the description is severely incomplete. It doesn't address behavioral aspects, parameter meanings, usage context, or expected outcomes, leaving the agent with insufficient information to use this tool effectively.

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?

With only 20% schema description coverage (only 'amount' has a description), the description provides no additional parameter information. It doesn't explain what account_id refers to, how payee_name should be formatted, what category_name options exist, or memo usage. For a tool with 5 parameters and poor schema coverage, this is inadequate.

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 ('Create') and resource ('new transaction in YNAB'), making the purpose immediately understandable. However, it doesn't differentiate this tool from potential sibling tools that might also create transactions or similar financial records, which prevents a perfect score.

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 no guidance on when to use this tool versus alternatives. With sibling tools like get_transactions and get_transactions_needing_attention available, there's no indication of whether this is for manual entry versus automated processing, or any prerequisites for creating transactions.

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