_find_transaction_by_id
Locate a specific transaction by its unique ID and type within the YNAB Server. Streamlines transaction retrieval for detailed tracking and management.
Instructions
Find a transaction by its ID and ID type.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id_type | Yes | ||
| transaction_id | Yes | ||
| transactions | Yes |
Implementation Reference
- src/mcp_ynab/server.py:545-564 (handler)The handler function for the '_find_transaction_by_id' tool, decorated with @mcp.tool(). It searches through a list of transactions to find one matching the given transaction_id based on the specified id_type (id, import_id, transfer_transaction_id, or matched_transaction_id).@mcp.tool() def _find_transaction_by_id( transactions: List[TransactionDetail], transaction_id: str, id_type: str ) -> Optional[TransactionDetail]: """Find a transaction by its ID and ID type.""" for txn in transactions: if ( (id_type == "id" and txn.id == transaction_id) or (id_type == "import_id" and txn.import_id == transaction_id) or ( id_type == "transfer_transaction_id" and txn.transfer_transaction_id == transaction_id ) or ( id_type == "matched_transaction_id" and txn.matched_transaction_id == transaction_id ) ): return txn return None