Skip to main content
Glama
Jtewen

You Need A Budget (YNAB) MCP

by Jtewen

bulk-manage-transactions

Create, update, or delete multiple YNAB transactions in bulk to streamline your budgeting workflow. Save time by managing multiple transactions simultaneously with this tool.

Instructions

Create, update, or delete multiple transactions at once. More efficient than making single changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe action to perform.
budget_idNoThe ID of the budget. If not provided, the default budget will be used.
create_transactionsNoA list of transactions to create. Required for 'create' action.
delete_transaction_idsNoA list of transaction IDs to delete. Required for 'delete' action.
update_transactionsNoA list of transactions to update. Required for 'update' action.

Implementation Reference

  • Main handler for the 'bulk-manage-transactions' tool. Validates input using BulkManageTransactionsInput, gets budget_id, then based on action ('create', 'update', 'delete'): prepares transaction data, calls corresponding ynab_client methods (create_transactions, update_transactions, delete_transaction), and returns formatted success response with details like created IDs or counts.
    elif name == "bulk-manage-transactions":
        args = BulkManageTransactionsInput.model_validate(arguments or {})
        budget_id = await _get_budget_id(args.model_dump())
    
        if args.action == "create":
            new_transactions = []
            for tx in args.create_transactions:
                tx_data = {k: v for k, v in tx.model_dump().items() if v is not None}
                if "amount" in tx_data:
                    tx_data["amount"] = int(tx_data["amount"])
                new_transactions.append(NewTransaction(**tx_data))
            
            result = await ynab_client.create_transactions(
                budget_id=budget_id, transactions=new_transactions
            )
    
            created_ids = ", ".join(result.transaction_ids)
            duplicate_ids = ", ".join(result.duplicate_import_ids)
    
            response_text = f"Successfully processed bulk transaction request. Server Knowledge: {result.server_knowledge}\n"
            if created_ids:
                response_text += f"Created transaction IDs: {created_ids}\n"
            if duplicate_ids:
                response_text += f"Duplicate import IDs (skipped): {duplicate_ids}\n"
            
            return [types.TextContent(type="text", text=response_text.strip())]
        
        elif args.action == "update":
            updates = []
            for tx in args.update_transactions:
                tx_data = {k: v for k, v in tx.model_dump().items() if v is not None}
                if "amount" in tx_data:
                    tx_data["amount"] = int(tx_data["amount"])
                updates.append(SaveTransactionWithIdOrImportId(**tx_data))
            await ynab_client.update_transactions(budget_id=budget_id, transactions=updates)
    
            return [
                types.TextContent(
                    type="text",
                    text=f"Successfully updated {len(args.update_transactions)} transactions.",
                )
            ]
    
        elif args.action == "delete":
            deleted_ids = []
            for tx_id in args.delete_transaction_ids:
                await ynab_client.delete_transaction(
                    budget_id=budget_id, transaction_id=tx_id
                )
                deleted_ids.append(tx_id)
            
            return [
                types.TextContent(
                    type="text",
                    text=f"Successfully deleted {len(deleted_ids)} transactions: {', '.join(deleted_ids)}",
                )
            ]
    elif name == "list-scheduled-transactions":
  • Pydantic input schema for bulk-manage-transactions tool, defining action enum and fields for create/update/delete operations. Includes model validator to enforce required fields based on action. References sub-models NewTransactionModel and TransactionUpdate.
    class BulkManageTransactionsAction(str, Enum):
        CREATE = "create"
        UPDATE = "update"
        DELETE = "delete"
    
    
    class BulkManageTransactionsInput(BudgetIdInput):
        action: BulkManageTransactionsAction = Field(..., description="The action to perform.")
        create_transactions: Optional[List[NewTransactionModel]] = Field(None, description="A list of transactions to create. Required for 'create' action.")
        update_transactions: Optional[List[TransactionUpdate]] = Field(None, description="A list of transactions to update. Required for 'update' action.")
        delete_transaction_ids: Optional[List[str]] = Field(None, description="A list of transaction IDs to delete. Required for 'delete' action.")
    
        @model_validator(mode='before')
        @classmethod
        def check_fields_for_action(cls, values):
            action = values.get('action')
            if not action:
                raise ValueError("'action' is a required field.")
    
            if action == 'create':
                if not values.get('create_transactions'):
                    raise ValueError("'create_transactions' is required for the 'create' action.")
            elif action == 'update':
                if not values.get('update_transactions'):
                    raise ValueError("'update_transactions' is required for the 'update' action.")
            elif action == 'delete':
                if not values.get('delete_transaction_ids'):
                    raise ValueError("'delete_transaction_ids' is required for the 'delete' action.")
            
            return values
  • Tool registration in the handle_list_tools() function, defining the tool's name, description, and input schema from BulkManageTransactionsInput.model_json_schema().
    types.Tool(
        name="bulk-manage-transactions",
        description="Create, update, or delete multiple transactions at once. More efficient than making single changes.",
        inputSchema=BulkManageTransactionsInput.model_json_schema(),
    ),
  • Sub-schema NewTransactionModel used in create_transactions list of BulkManageTransactionsInput for defining new transaction details.
    class NewTransactionModel(BaseModel):
        account_id: str = Field(..., description="The ID of the account for the transaction.")
        date: str = Field(..., description="The transaction date in YYYY-MM-DD format.")
        amount: float = Field(..., description="The transaction amount in milliunits.")
        payee_id: Optional[str] = Field(None, description="The ID of the payee.")
        payee_name: Optional[str] = Field(
            None, description="The name of the payee. If not provided, a new payee will be created."
        )
        category_id: Optional[str] = Field(
            None, description="The ID of the category for the transaction."
        )
        memo: Optional[str] = Field(None, description="A memo for the transaction.")
        cleared: Optional[str] = Field(
            None, description="The cleared status of the transaction.",
        )
        approved: bool = Field(False, description="Whether or not the transaction is approved.")
        flag_color: Optional[str] = Field(
            None, description="The flag color of the transaction.",
        )
        import_id: Optional[str] = Field(
            None, description="A unique import ID for the transaction. Use for idempotency."
        )
  • Sub-schema TransactionUpdate used in update_transactions list of BulkManageTransactionsInput for defining updates to existing transactions.
    class TransactionUpdate(BaseModel):
        id: str = Field(..., description="The ID of the transaction to update.")
        account_id: Optional[str] = Field(None, description="The ID of the account.")
        date: Optional[str] = Field(None, description="The transaction date in YYYY-MM-DD format.")
        amount: Optional[float] = Field(None, description="The transaction amount in milliunits.")
        category_id: Optional[str] = Field(
            None, description="The ID of the category for the transaction."
        )
        payee_id: Optional[str] = Field(None, description="The ID of the payee.")
        memo: Optional[str] = Field(None, description="A memo for the transaction.")
        cleared: Optional[str] = Field(
            None, description="The cleared status of the transaction.",
        )
        approved: Optional[bool] = Field(None, description="Whether or not the transaction is approved.")
        flag_color: Optional[str] = Field(
            None, description="The flag color of the transaction.",
        )
Behavior2/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 of behavioral disclosure. It states the tool performs create/update/delete operations, implying mutations, but doesn't cover critical aspects like permissions required, whether changes are reversible, error handling for partial failures, rate limits, or what the response looks like (since no output schema exists). For a bulk mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 extremely concise and front-loaded: two sentences that directly state the tool's purpose and key benefit ('more efficient than making single changes'). Every word earns its place with zero waste, making it easy to scan and understand quickly. No unnecessary details or redundancy are present.

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?

Given the tool's complexity (bulk mutations with multiple actions), lack of annotations, and no output schema, the description is incomplete. It doesn't address behavioral risks (e.g., data loss from deletes), response format, error scenarios, or integration with sibling tools (e.g., 'list-transactions' for verification). For a powerful mutation tool, more context is needed to ensure safe and effective use by an AI agent.

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 schema description coverage is 100%, with detailed parameter descriptions in the input schema (e.g., 'action' as the action to perform, 'create_transactions' required for 'create' action). The description adds no parameter-specific information beyond what's in the schema, such as explaining how actions map to parameters or providing usage examples. Given the high schema coverage, the baseline score of 3 is appropriate, as the schema does the heavy lifting.

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 tool's purpose: 'Create, update, or delete multiple transactions at once.' It specifies the verb ('create, update, or delete') and resource ('transactions'), and distinguishes it from single operations by noting it's 'more efficient than making single changes.' However, it doesn't explicitly differentiate from sibling tools like 'list-transactions' or 'manage-scheduled-transaction,' which keeps it from 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 minimal guidance: it mentions efficiency over single changes, implying this tool should be used for bulk operations. However, it lacks explicit when-to-use criteria, prerequisites (e.g., budget context), or alternatives (e.g., when to use 'list-transactions' for reading vs. this for writing). No exclusions or detailed context are provided, making it insufficient for clear decision-making.

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