get_card_statements_primary
Retrieve complete primary card account statements from Brex financial platform. Use this tool to access full statement objects with pagination controls for financial data analysis.
Instructions
Get complete statements for the primary card account. Returns full statement objects. Example: {"limit":10}
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | ||
| limit | No |
Implementation Reference
- Core execution logic for the 'get_card_statements_primary' tool: validates input, fetches statements from Brex primary card account, and returns JSON-formatted list with pagination metadata.registerToolHandler("get_card_statements_primary", async (request: ToolCallRequest) => { try { const params = validateParams(request.params.arguments); const client = getBrexClient(); const resp = await client.getPrimaryCardStatements(params.cursor, params.limit); const items = Array.isArray(resp.items) ? resp.items : []; return { content: [{ type: "text", text: JSON.stringify({ statements: items, meta: { count: items.length, next_cursor: (resp as any).next_cursor || null } }, null, 2) }] }; } catch (error) { logError(`Error in get_card_statements_primary: ${error instanceof Error ? error.message : String(error)}`); throw error; } });
- TypeScript interface definition and runtime validation function for tool input parameters (cursor and limit).interface GetCardStatementsParams { cursor?: string; limit?: number; } function validateParams(input: unknown): GetCardStatementsParams { const raw = (input || {}) as Record<string, unknown>; const out: GetCardStatementsParams = {}; 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; }
- src/tools/getCardStatementsPrimary.ts:31-56 (registration)Registers the tool handler function into the central toolHandlers Map using registerToolHandler.export function registerGetCardStatementsPrimary(_server: Server): void { registerToolHandler("get_card_statements_primary", async (request: ToolCallRequest) => { try { const params = validateParams(request.params.arguments); const client = getBrexClient(); const resp = await client.getPrimaryCardStatements(params.cursor, params.limit); const items = Array.isArray(resp.items) ? resp.items : []; return { content: [{ type: "text", text: JSON.stringify({ statements: items, meta: { count: items.length, next_cursor: (resp as any).next_cursor || null } }, null, 2) }] }; } catch (error) { logError(`Error in get_card_statements_primary: ${error instanceof Error ? error.message : String(error)}`); throw error; } }); }
- src/tools/index.ts:182-190 (schema)Official MCP tool schema (inputSchema) exposed in the listTools handler response.name: "get_card_statements_primary", description: "Get complete statements for the primary card account. Returns full statement objects. Example: {\"limit\":10}", inputSchema: { type: "object", properties: { cursor: { type: "string" }, limit: { type: "number" } } }
- src/tools/index.ts:60-60 (registration)Top-level invocation of the tool registration during server tools setup in registerTools.registerGetCardStatementsPrimary(server);