Skip to main content
Glama
elcukro

bank-mcp

by elcukro

search_transactions

Find specific payments or payees by searching across transaction descriptions, merchant names, and references using full-text matching.

Instructions

Full-text search across transaction descriptions, merchant names, and references. Use for finding specific payments or payees.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch text — matched against description, merchant name, and reference.
connectionIdNo
dateFromNo
dateToNo
limitNoMax results. Default 50.

Implementation Reference

  • The searchTransactions handler function. Fetches all transactions via listTransactions for the given date range, then filters locally by performing a case-insensitive substring match on description, merchantName, and reference fields. Returns up to 'limit' matches (default 50).
    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);
    }
  • Zod schema for search_transactions input: query (required string), connectionId (optional), dateFrom/dateTo (optional strings), limit (optional number, 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: name 'search_transactions', description, and inputSchema derived from searchTransactionsSchema.
    {
      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: the 'search_transactions' key maps to the searchTransactions function, parsing args with searchTransactionsSchema.
    search_transactions: (args) =>
      searchTransactions(searchTransactionsSchema.parse(args)),
  • The listTransactions helper function that searchTransactions delegates to. Fetches transactions from provider(s) across connections/accounts with caching, date range filtering, and local post-filters (amount, type).
    export async function listTransactions(
      args: z.infer<typeof listTransactionsSchema>,
    ): Promise<Transaction[]> {
      const config = loadConfig();
      const dateFrom = args.dateFrom || defaultDateFrom(config.defaults.transactionDays);
      const dateTo = args.dateTo || today();
    
      const filter: TransactionFilter = {
        dateFrom,
        dateTo,
        amountMin: args.amountMin,
        amountMax: args.amountMax,
        type: args.type,
        limit: args.limit,
      };
    
      // Resolve which connections and accounts to query
      const connections = args.connectionId
        ? [getConnection(config, args.connectionId)]
        : getAllConnections(config);
    
      const allTx: Transaction[] = [];
    
      for (const conn of connections) {
        const provider = getProvider(conn.provider);
    
        // Get account list (may come from cache)
        let accountIds: string[];
        if (args.accountId) {
          accountIds = [args.accountId];
        } else {
          const accounts = await provider.listAccounts(conn.config);
          accountIds = accounts.map((a) => a.uid);
        }
    
        for (const accId of accountIds) {
          const cacheKey = `tx:${conn.id}:${accId}:${dateFrom}:${dateTo}`;
          const cached = cache.get<Transaction[]>(cacheKey);
    
          if (cached) {
            allTx.push(...applyLocalFilters(cached, filter));
            continue;
          }
    
          const transactions = await provider.listTransactions(
            conn.config,
            accId,
            { dateFrom, dateTo },
          );
          cache.set(cacheKey, transactions, TTL.TRANSACTIONS);
          allTx.push(...applyLocalFilters(transactions, filter));
        }
      }
    
      // Sort by date descending (most recent first)
      allTx.sort((a, b) => b.date.localeCompare(a.date));
    
      return args.limit ? allTx.slice(0, args.limit) : allTx;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden. It describes the search operation but does not disclose whether it is read-only, any performance implications, pagination behavior, or error handling. The word 'search' implies read but is not explicit.

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

Conciseness5/5

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

The description is two sentences long with no extraneous words. The first sentence states the action, the second provides usage context. Every word earns its place.

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?

The tool has 5 parameters (1 required) and no output schema. While the purpose is clear, the description fails to explain optional parameters like connectionId, dateFrom, dateTo, and does not describe return format or behavior for edge cases. This leaves gaps for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 40% (only query and limit have descriptions). The description adds semantics for query (full-text across specific fields) but does not explain connectionId, dateFrom, or dateTo. With low schema coverage, the description should compensate but does not fully.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it is a 'full-text search across transaction descriptions, merchant names, and references' with a specific use case of 'finding specific payments or payees'. This distinctly separates it from sibling tools like list_transactions which likely list all transactions without search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description indicates when to use the tool ('for finding specific payments or payees') but does not explicitly mention when not to use it or compare to alternatives like list_transactions. The guidance is clear but lacks explicit exclusionary context.

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

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/elcukro/bank-mcp'

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