Skip to main content
Glama
Meh-S-Eze

MCP YNAB Server

get_transactions_needing_attention

Identify YNAB budget transactions requiring action by filtering uncategorized, unapproved, or both types within a specified timeframe.

Instructions

List transactions that need attention based on specified filter type in a YNAB budget.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idYes
days_backNoNumber of days to look back (default 30, None for all)
filter_typeNoType of transactions to show. One of: 'uncategorized', 'unapproved', 'both'both

Implementation Reference

  • Main execution logic for the get_transactions_needing_attention tool. Fetches accounts and transactions from YNAB API, filters for those needing attention (uncategorized and/or unapproved), formats into a Markdown table, and returns it. Includes input schema via Annotated Fields.
    @mcp.tool()
    async def get_transactions_needing_attention(
        budget_id: str,
        filter_type: Annotated[
            str,
            Field(
                description="Type of transactions to show. One of: 'uncategorized', 'unapproved', 'both'"
            ),
        ] = "both",
        days_back: Annotated[
            Optional[int], Field(description="Number of days to look back (default 30, None for all)")
        ] = 30,
    ) -> str:
        """List transactions that need attention based on specified filter type in a YNAB budget."""
        filter_type = filter_type.lower()
        if filter_type not in ["uncategorized", "unapproved", "both"]:
            return "Error: Invalid filter_type. Must be 'uncategorized', 'unapproved', or 'both'"
    
        async with await get_ynab_client() as client:
            transactions_api = TransactionsApi(client)
            accounts_api = AccountsApi(client)
    
            accounts_response = accounts_api.get_accounts(budget_id)
            account_map = {
                account.id: account.name
                for account in accounts_response.data.accounts
                if not account.closed and not account.deleted
            }
    
            since_date = (datetime.now() - timedelta(days=days_back)).date() if days_back else None
            response = transactions_api.get_transactions(budget_id, since_date=since_date)
            needs_attention = _filter_transactions(response.data.transactions, filter_type)
    
            markdown = f"# Transactions Needing Attention ({filter_type.title()})\n\n"
            if not needs_attention:
                return markdown + "_No transactions need attention._"
    
            markdown += "**Filters Applied:**\n"
            markdown += f"- Filter type: {filter_type}\n"
            if days_back:
                markdown += f"- Looking back {days_back} days\n"
            markdown += "\n"
    
            headers = ["ID", "Date", "Account", "Amount", "Payee", "Status", "Memo"]
            align = ["left", "left", "left", "right", "left", "left", "left"]
            rows = [_get_transaction_row(txn, account_map, filter_type) for txn in needs_attention]
    
            markdown += _build_markdown_table(rows, headers, align)
            return markdown
  • Helper function to filter transactions that are uncategorized, unapproved, or both, based on the filter_type parameter.
    def _filter_transactions(
        transactions: List[TransactionDetail], filter_type: str
    ) -> List[TransactionDetail]:
        """Filter transactions based on the filter type."""
        needs_attention = []
        for txn in transactions:
            if isinstance(txn, TransactionDetail):
                needs_category = filter_type in ["uncategorized", "both"] and not txn.category_id
                needs_approval = filter_type in ["unapproved", "both"] and not txn.approved
                if needs_category or needs_approval:
                    needs_attention.append(txn)
        return needs_attention
  • Helper function to format a single transaction into a list for the Markdown table row, including status flags for uncategorized/unapproved.
    def _get_transaction_row(
        txn: TransactionDetail, account_map: Dict[str, str], filter_type: str
    ) -> List[str]:
        """Format a transaction into a row for the markdown table."""
        amount_dollars = float(txn.amount) / 1000
        amount_str = f"${abs(amount_dollars):,.2f}"
        if amount_dollars < 0:
            amount_str = f"-{amount_str}"
    
        status = []
        if not txn.category_id:
            status.append("Uncategorized")
        if not txn.approved:
            status.append("Unapproved")
    
        return [
            txn.id,
            txn.var_date.strftime("%Y-%m-%d"),
            account_map.get(txn.account_id, "Unknown"),
            amount_str,
            txn.payee_name or "N/A",
            ", ".join(status),
            txn.memo or "",
        ]
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It doesn't disclose whether this is a read-only operation (implied by 'List'), what permissions are needed, whether results are paginated, or what format the output takes. The phrase 'need attention' is vague without explaining what constitutes 'attention' in this context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose upfront. However, it could be more front-loaded by specifying what 'needing attention' means immediately rather than leaving it implied through 'filter type'.

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 tool with 3 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what constitutes 'transactions needing attention', what the output format will be, or how this tool differs from the sibling 'get_transactions' tool. The vague 'needing attention' concept requires more clarification for effective use.

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?

Schema description coverage is 67% (2 of 3 parameters have descriptions). The description adds minimal value beyond the schema - it mentions 'filter type' but doesn't elaborate on what 'needing attention' means for each filter option. It doesn't explain the relationship between 'days_back' and 'needing attention' criteria. Baseline 3 is appropriate given moderate schema coverage.

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 verb ('List') and resource ('transactions that need attention'), and specifies the context ('in a YNAB budget'). It distinguishes from generic 'get_transactions' by focusing on 'needing attention' transactions, though it doesn't explicitly differentiate from all siblings like 'create_transaction' or 'get_accounts'.

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 like 'get_transactions' (which presumably lists all transactions) or other filtering tools. It mentions 'based on specified filter type' but doesn't explain when different filter types are appropriate or what 'needing attention' means in practice.

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