Skip to main content
Glama
crazyrabbitLTC

Brex MCP Server

get_cash_transactions

Retrieve cash transaction data from Brex accounts to monitor financial activity, filter by date, and manage pagination for detailed reporting.

Instructions

LIST: Cash transactions (requires cash scopes). Example: {"account_id":"cash_acc_123","limit":10}. Returns complete transaction objects.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYesCash account ID
cursorNoPagination cursor
limitNoItems per page (1-100)
posted_at_startNoISO timestamp to start from
expandNoFields to expand

Implementation Reference

  • Primary handler registration and execution logic for the 'get_cash_transactions' tool. Validates input parameters, calls the Brex API via client.getCashTransactions, processes the response, and returns formatted JSON with transactions and pagination metadata.
    export function registerGetCashTransactions(_server: Server): void {
      registerToolHandler("get_cash_transactions", async (request: ToolCallRequest) => {
        try {
          const params = validateParams(request.params.arguments);
          const client = getBrexClient();
          
          // Call API with all supported parameters
          const resp = await client.getCashTransactions(params.account_id, {
            cursor: params.cursor,
            limit: params.limit,
            posted_at_start: params.posted_at_start,
            expand: params.expand
          });
          
          // Return complete transaction objects without any filtering or summarization
          const items = Array.isArray(resp.items) ? resp.items : [];
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify({
                transactions: items,
                meta: {
                  count: items.length,
                  next_cursor: (resp as any).next_cursor
                }
              }, null, 2)
            }]
          };
        } catch (error) {
          logError(`Error in get_cash_transactions: ${error instanceof Error ? error.message : String(error)}`);
          throw error;
        }
      });
    }
  • MCP tool specification including name, description, and inputSchema (JSON Schema) for validating 'get_cash_transactions' tool calls.
    {
      name: "get_cash_transactions",
      description: "LIST: Cash transactions (requires cash scopes). Example: {\"account_id\":\"cash_acc_123\",\"limit\":10}. Returns complete transaction objects.",
      inputSchema: {
        type: "object",
        properties: {
          account_id: { type: "string", description: "Cash account ID" },
          cursor: { type: "string", description: "Pagination cursor" },
          limit: { type: "number", description: "Items per page (1-100)" },
          posted_at_start: { type: "string", description: "ISO timestamp to start from" },
          expand: { type: "array", items: { type: "string" }, description: "Fields to expand" }
        },
        required: ["account_id"]
      }
    },
  • Registers the get_cash_transactions tool handler during server initialization by calling its dedicated registration function.
    registerGetCashTransactions(server);
  • BrexClient helper method that performs the actual API call to retrieve cash transactions for a specific account ID, handling parameters and pagination.
    async getCashTransactions(id: string, options?: {
      cursor?: string;
      limit?: number;
      posted_at_start?: string;
      expand?: string[];
    }): Promise<PageCashTransaction> {
      try {
        const params: Record<string, unknown> = {};
        if (options) {
          if (options.cursor) params.cursor = options.cursor;
          if (options.limit) params.limit = options.limit;
          if (options.posted_at_start) params.posted_at_start = options.posted_at_start;
          if (options.expand) params.expand = options.expand;
        }
    
        logDebug(`Fetching cash transactions for account ${id} from Brex API`);
        const response = await this.client.get(`/v2/transactions/cash/${id}`, { params });
        logDebug(`Successfully fetched ${response.data.items.length} cash transactions for account ${id}`);
        return response.data;
      } catch (error) {
        this.handleApiError(error, 'GET', `/v2/transactions/cash/${id}`);
        throw error;
      }
    }
  • Parameter validation and normalization function for get_cash_transactions tool inputs, enforcing required fields and type conversions.
    function validateParams(input: unknown): GetCashTransactionsParams {
      const raw = (input || {}) as Record<string, unknown>;
      if (!raw.account_id) throw new Error("Missing required parameter: account_id");
      const out: GetCashTransactionsParams = { account_id: String(raw.account_id) };
      
      if (raw.cursor !== undefined) out.cursor = String(raw.cursor);
      
      if (raw.limit !== undefined) {
        const n = parseInt(String(raw.limit), 10);
        if (isNaN(n) || n <= 0 || n > 100) throw new Error("Invalid limit (1..100)");
        out.limit = n;
      }
      
      if (raw.posted_at_start !== undefined) {
        out.posted_at_start = new Date(String(raw.posted_at_start)).toISOString();
      }
      
      if (raw.expand !== undefined) {
        out.expand = Array.isArray(raw.expand) ? raw.expand.map(String) : [String(raw.expand)];
      }
      
      // Ignore deprecated parameters silently
      // summary_only and fields are no longer supported but we don't error out
      
      return out;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions authentication requirements ('requires cash scopes') and return format ('complete transaction objects'), but lacks details on pagination behavior (cursor usage), rate limits, error conditions, or what 'complete' entails. This is inadequate for a tool with 5 parameters and no output schema.

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 concise with two sentences: one stating purpose and requirements, and another with an example and return format. It's front-loaded with key information, though the example could be more integrated. No wasted words, but slightly awkward structure with the example embedded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 5 parameters, no annotations, and no output schema, the description is moderately complete. It covers authentication and return format but misses pagination behavior, error handling, and detailed usage context. For a list tool with siblings, it should better differentiate and explain operational constraints.

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 100%, so the schema fully documents all 5 parameters. The description adds minimal value by providing an example with 'account_id' and 'limit', but doesn't explain parameter interactions, semantics beyond the schema, or clarify the 'expand' field. Baseline 3 is appropriate as the schema does the heavy lifting.

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 'cash transactions', making the purpose explicit. It distinguishes from siblings like 'get_transactions' by specifying 'cash' scope, though it doesn't explicitly mention how it differs from 'get_cash_account_statements' or 'get_card_transactions'.

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

Usage Guidelines3/5

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

The description provides some usage context by stating 'requires cash scopes', which implies when authentication is needed. However, it doesn't explicitly guide when to use this tool versus alternatives like 'get_transactions' or 'get_cash_account_statements', nor does it mention prerequisites or exclusions.

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/crazyrabbitLTC/mcp-brex-server'

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