Skip to main content
Glama
elcukro

bank-mcp

by elcukro

list_transactions

Retrieve bank transactions with customizable filters for date ranges, amounts, and transaction types to analyze financial activity.

Instructions

List bank transactions with optional filters. Defaults to last 90 days. Supports date range, amount range, and debit/credit type filtering.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionIdNoConnection ID. If omitted, queries all connections.
accountIdNoAccount UID. If omitted, queries all accounts.
dateFromNoStart date (YYYY-MM-DD). Defaults to 90 days ago.
dateToNoEnd date (YYYY-MM-DD). Defaults to today.
amountMinNoMinimum absolute amount.
amountMaxNoMaximum absolute amount.
typeNoFilter by transaction type.
limitNoMaximum number of transactions to return.

Implementation Reference

  • Main handler function that implements the list_transactions tool logic. It resolves connections/accounts, applies caching, calls provider.listTransactions for each account, applies local filters, sorts results by date, and returns the final transaction list.
    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;
    }
  • Zod schema defining the input validation for list_transactions tool. Includes optional fields: connectionId, accountId, dateFrom, dateTo, amountMin, amountMax, type (debit/credit), and limit.
    export const listTransactionsSchema = z.object({
      connectionId: z
        .string()
        .optional()
        .describe("Connection ID. If omitted, queries all connections."),
      accountId: z
        .string()
        .optional()
        .describe("Account UID. If omitted, queries all accounts."),
      dateFrom: z
        .string()
        .optional()
        .describe('Start date (YYYY-MM-DD). Defaults to 90 days ago.'),
      dateTo: z
        .string()
        .optional()
        .describe('End date (YYYY-MM-DD). Defaults to today.'),
      amountMin: z
        .number()
        .optional()
        .describe("Minimum absolute amount."),
      amountMax: z
        .number()
        .optional()
        .describe("Maximum absolute amount."),
      type: z
        .enum(["debit", "credit"])
        .optional()
        .describe("Filter by transaction type."),
      limit: z
        .number()
        .optional()
        .describe("Maximum number of transactions to return."),
    });
  • src/server.ts:32-36 (registration)
    Tool registration in TOOLS array defining the 'list_transactions' tool with its description and inputSchema reference.
      name: "list_transactions",
      description:
        "List bank transactions with optional filters. Defaults to last 90 days. Supports date range, amount range, and debit/credit type filtering.",
      inputSchema: z.toJSONSchema(listTransactionsSchema),
    },
  • src/server.ts:61-62 (registration)
    Handler registration mapping the 'list_transactions' tool name to the listTransactions function with schema parsing.
    list_transactions: (args) =>
      listTransactions(listTransactionsSchema.parse(args)),
  • Helper functions supporting the list_transactions handler: applyLocalFilters (filters by amount/type), defaultDateFrom (calculates start date from days), and today (returns current date string).
    function applyLocalFilters(
      txs: Transaction[],
      f: TransactionFilter,
    ): Transaction[] {
      let result = txs;
      if (f.amountMin !== undefined) {
        result = result.filter((t) => Math.abs(t.amount) >= f.amountMin!);
      }
      if (f.amountMax !== undefined) {
        result = result.filter((t) => Math.abs(t.amount) <= f.amountMax!);
      }
      if (f.type) {
        result = result.filter((t) => t.type === f.type);
      }
      return result;
    }
    
    function defaultDateFrom(days: number): string {
      const d = new Date();
      d.setDate(d.getDate() - days);
      return d.toISOString().slice(0, 10);
    }
    
    function today(): string {
      return new Date().toISOString().slice(0, 10);
    }
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 of behavioral disclosure. It mentions default date range and filter support, but lacks critical details like whether this is a read-only operation, pagination behavior, rate limits, authentication requirements, or what happens when no filters are applied. For a tool with 8 parameters and no annotation coverage, this is insufficient.

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 appropriately concise—two sentences that efficiently state the purpose and key features. It's front-loaded with the main purpose and avoids unnecessary elaboration. However, it could be slightly more structured by explicitly separating purpose from filter details.

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?

Given the tool's complexity (8 parameters, no output schema, no annotations), the description is incomplete. It doesn't address behavioral aspects like safety, performance, or error handling, nor does it explain the return format or how results are structured. For a list/filter tool with multiple siblings, more context is needed to guide 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?

The description adds minimal value beyond the input schema, which has 100% description coverage. It mentions 'date range, amount range, and debit/credit type filtering,' but these are already documented in the schema. The description doesn't provide additional context about parameter interactions, defaults beyond dates, or usage examples. Baseline 3 is appropriate given high 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 tool's purpose: 'List bank transactions with optional filters.' It specifies the resource (bank transactions) and action (list with filtering). However, it doesn't explicitly differentiate from sibling tools like 'search_transactions' or 'spending_summary,' which likely have overlapping functionality.

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 'search_transactions' or 'spending_summary.' It mentions default behavior (last 90 days) and supported filters, but offers no explicit when-to-use or when-not-to-use context relative to siblings.

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