search_transactions
Find specific bank transactions by searching descriptions, merchant names, and references to identify payments or payees.
Instructions
Full-text search across transaction descriptions, merchant names, and references. Use for finding specific payments or payees.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search text — matched against description, merchant name, and reference. | |
| connectionId | No | ||
| dateFrom | No | ||
| dateTo | No | ||
| limit | No | Max results. Default 50. |
Implementation Reference
- src/tools/search-transactions.ts:14-33 (handler)Main handler function that executes search_transactions logic. Fetches transactions using listTransactions for the specified date range/connection, then filters them locally by matching the query string (case-insensitive) against description, merchant name, and reference fields, applying the specified limit.export async function searchTransactions( args: z.infer<typeof searchTransactionsSchema>, ): Promise<unknown> { // Fetch all transactions for the date range, then filter locally const transactions = await listTransactions({ connectionId: args.connectionId, dateFrom: args.dateFrom, dateTo: args.dateTo, }); const q = args.query.toLowerCase(); const limit = args.limit || 50; const matches = transactions.filter((t) => { const fields = [t.description, t.merchantName, t.reference].filter(Boolean); return fields.some((f) => f!.toLowerCase().includes(q)); }); return matches.slice(0, limit); }
- Input schema for search_transactions tool using Zod. Defines required 'query' parameter (search text) and optional parameters: connectionId, dateFrom, dateTo, and limit (default 50).export const searchTransactionsSchema = z.object({ query: z .string() .describe("Search text — matched against description, merchant name, and reference."), connectionId: z.string().optional(), dateFrom: z.string().optional(), dateTo: z.string().optional(), limit: z.number().optional().describe("Max results. Default 50."), });
- src/server.ts:37-42 (registration)Tool registration in the TOOLS array. Defines the tool name 'search_transactions', description for full-text search across transactions, and maps to the searchTransactionsSchema for input validation.{ name: "search_transactions", description: "Full-text search across transaction descriptions, merchant names, and references. Use for finding specific payments or payees.", inputSchema: z.toJSONSchema(searchTransactionsSchema), },
- src/server.ts:63-64 (registration)Handler mapping in the handlers record that routes 'search_transactions' tool calls to the searchTransactions function with schema validation.search_transactions: (args) => searchTransactions(searchTransactionsSchema.parse(args)),