Skip to main content
Glama
crazyrabbitLTC

Brex MCP Server

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
NameRequiredDescriptionDefault
cursorNo
limitNo

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;
    }
  • 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;
        }
      });
    }
  • 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" }
      }
    }
  • Top-level invocation of the tool registration during server tools setup in registerTools.
    registerGetCardStatementsPrimary(server);
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 states that it 'Returns full statement objects' which gives some output context, but doesn't describe whether this is a read-only operation, if it requires authentication, rate limits, pagination behavior (implied by cursor/limit parameters), or error conditions. The example parameter is helpful but insufficient for comprehensive behavioral understanding.

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 brief with two sentences that directly address purpose and provide a parameter example. There's no unnecessary verbiage, and the information is front-loaded. However, the example could be better integrated into the text rather than appended as a separate fragment.

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?

For a tool with 2 parameters, 0% schema coverage, no annotations, and no output schema, the description is inadequate. It doesn't explain what 'statement objects' contain, how pagination works with cursor/limit, error handling, or authentication requirements. The example helps slightly but doesn't compensate for the significant gaps in context needed for proper tool invocation.

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?

The input schema has 2 parameters with 0% description coverage, so the description must compensate. It only provides an example for 'limit' parameter ('Example: {"limit":10}') but doesn't explain what 'cursor' does or the semantics of either parameter. This leaves half the parameters undocumented and provides minimal context for the documented one.

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 'Get' and the resource 'complete statements for the primary card account', making the purpose understandable. It distinguishes from siblings like 'get_cash_account_statements' by specifying 'primary card account', but doesn't explicitly contrast with other statement-related tools. The description is specific but could be more precise about what distinguishes it from similar tools.

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 'get_cash_account_statements' or 'get_card_transactions'. It mentions an example parameter value but doesn't explain the context for usage, prerequisites, or exclusions. There's minimal implicit guidance from the tool name alone, but no explicit usage instructions.

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