Skip to main content
Glama

get_transactions

Retrieve recent transactions for a specific account and budget using the MCP YNAB Server. Input budget_id and account_id to access transaction data.

Instructions

Get recent transactions for a specific account in a specific budget.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYes
budget_idYes

Implementation Reference

  • The handler function for the 'get_transactions' MCP tool. It fetches transactions for a given budget and account since the 1st of the current month using the YNAB API, formats them into a markdown table, and returns the result.
    @mcp.tool() async def get_transactions(budget_id: str, account_id: str) -> str: """Get recent transactions for a specific account in a specific budget.""" async with await get_ynab_client() as client: transactions_api = TransactionsApi(client) all_transactions: List[TransactionDetail] = [] since_date = datetime.now().replace(day=1).date() response = transactions_api.get_transactions_by_account( budget_id, account_id, since_date=since_date ) all_transactions.extend(response.data.transactions) markdown = "# Recent Transactions\n\n" if not all_transactions: return markdown + "_No recent transactions found._\n" headers = ["ID", "Date", "Amount", "Payee Name", "Category Name", "Memo"] align = ["left", "left", "right", "left", "left", "left"] rows = [] for txn in all_transactions: amount_str = f"${txn.amount / 1000:,.2f}" rows.append( [ txn.id, txn.var_date.strftime("%Y-%m-%d"), amount_str, txn.payee_name or "N/A", txn.category_name or "N/A", txn.memo or "", ] ) markdown += _build_markdown_table(rows, headers, align) return markdown

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