Skip to main content
Glama
robcerda

monarch-mcp-server

by robcerda

create_transaction

Add a new transaction to a specified account in Monarch Money, including amount, description, date, and optional details like category and merchant name.

Instructions

Create a new transaction in Monarch Money.

Args:
    account_id: The account ID to add the transaction to
    amount: Transaction amount (positive for income, negative for expenses)
    description: Transaction description
    date: Transaction date in YYYY-MM-DD format
    category_id: Optional category ID
    merchant_name: Optional merchant name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYes
amountYes
category_idNo
dateYes
descriptionYes
merchant_nameNo

Implementation Reference

  • The create_transaction tool handler decorated with @mcp.tool(). It handles input parameters, authenticates with MonarchMoney client, prepares transaction data, and calls the client's create_transaction method via an async wrapper.
    @mcp.tool()
    def create_transaction(
        account_id: str,
        amount: float,
        description: str,
        date: str,
        category_id: Optional[str] = None,
        merchant_name: Optional[str] = None,
    ) -> str:
        """
        Create a new transaction in Monarch Money.
    
        Args:
            account_id: The account ID to add the transaction to
            amount: Transaction amount (positive for income, negative for expenses)
            description: Transaction description
            date: Transaction date in YYYY-MM-DD format
            category_id: Optional category ID
            merchant_name: Optional merchant name
        """
        try:
    
            async def _create_transaction():
                client = await get_monarch_client()
    
                transaction_data = {
                    "account_id": account_id,
                    "amount": amount,
                    "description": description,
                    "date": date,
                }
    
                if category_id:
                    transaction_data["category_id"] = category_id
                if merchant_name:
                    transaction_data["merchant_name"] = merchant_name
    
                return await client.create_transaction(**transaction_data)
    
            result = run_async(_create_transaction())
    
            return json.dumps(result, indent=2, default=str)
        except Exception as e:
            logger.error(f"Failed to create transaction: {e}")
            return f"Error creating transaction: {str(e)}"
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/robcerda/monarch-mcp-server'

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