Skip to main content
Glama

get_cash_account_statements

Retrieve cash account statements by account ID to access transaction history and financial records. Returns complete statement objects with pagination support for efficient data management.

Instructions

Get cash account statements by account ID. Returns complete statement objects. Example: {"account_id":"cash_acc_123","limit":5}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYesCash account ID
cursorNoPagination cursor
limitNoItems per page (default 50, max 100)

Implementation Reference

  • The main tool handler function that validates parameters, calls the Brex client to fetch cash account statements, formats the response as JSON, and handles errors.
    registerToolHandler("get_cash_account_statements", async (request: ToolCallRequest) => { try { const params = validateParams(request.params.arguments); const client = getBrexClient(); const resp = await client.getCashAccountStatements(params.account_id, params.cursor, params.limit); // Return complete objects without any summarization const items = Array.isArray(resp?.items) ? resp.items : []; return { content: [{ type: "text", text: JSON.stringify({ statements: items, meta: { count: items.length, next_cursor: resp?.next_cursor || undefined } }, null, 2) }] }; } catch (error) { logError(`Error in get_cash_account_statements: ${error instanceof Error ? error.message : String(error)}`); throw error; } });
  • JSON schema definition for the tool input parameters as registered with the MCP server.
    name: "get_cash_account_statements", description: "Get cash account statements by account ID. Returns complete statement objects. Example: {\"account_id\":\"cash_acc_123\",\"limit\":5}", 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 (default 50, max 100)" } }, required: ["account_id"] } },
  • Function that registers the get_cash_account_statements tool handler with the tool registry.
    export function registerGetCashAccountStatements(_server: Server): void { registerToolHandler("get_cash_account_statements", async (request: ToolCallRequest) => { try { const params = validateParams(request.params.arguments); const client = getBrexClient(); const resp = await client.getCashAccountStatements(params.account_id, params.cursor, params.limit); // Return complete objects without any summarization const items = Array.isArray(resp?.items) ? resp.items : []; return { content: [{ type: "text", text: JSON.stringify({ statements: items, meta: { count: items.length, next_cursor: resp?.next_cursor || undefined } }, null, 2) }] }; } catch (error) { logError(`Error in get_cash_account_statements: ${error instanceof Error ? error.message : String(error)}`); throw error; } }); }
  • Parameter validation and parsing function for tool inputs.
    function validateParams(input: unknown): GetCashAccountStatementsParams { const raw = (input || {}) as Record<string, unknown>; if (!raw.account_id) throw new Error("Missing required parameter: account_id"); const out: GetCashAccountStatementsParams = { 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; } return out; }
  • BrexClient method that performs the actual API call to retrieve cash account statements.
    async getCashAccountStatements(id: string, cursor?: string, limit?: number): Promise<PageStatement> { try { const params: Record<string, unknown> = {}; if (cursor) params.cursor = cursor; if (limit) params.limit = limit; logDebug(`Fetching statements for cash account ${id} from Brex API`); const response = await this.client.get(`/v2/accounts/cash/${id}/statements`, { params }); logDebug(`Successfully fetched ${response.data.items.length} statements for cash account ${id}`); return response.data; } catch (error) { this.handleApiError(error, 'GET', `/v2/accounts/cash/${id}/statements`); throw error; } }

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