Skip to main content
Glama
crazyrabbitLTC

Brex MCP Server

get_account_details

Retrieve comprehensive account information from Brex, including balances, transactions, and financial data, to monitor business finances and analyze spending patterns.

Instructions

Get detailed information about a Brex account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYesID of the Brex account

Implementation Reference

  • The core handler function that registers and executes the get_account_details tool logic: validates input parameters, fetches account details from Brex API, optionally enriches with recent transactions, and returns formatted JSON response.
    registerToolHandler("get_account_details", async (request: ToolCallRequest) => {
      try {
        // Validate parameters
        const params = validateParams(request.params.arguments as unknown as Record<string, unknown>);
        logDebug(`Getting account details for account ${params.accountId}`);
        
        // Get Brex client
        const brexClient = getBrexClient();
        
        try {
          // Call Brex API to get account details
          const account = await brexClient.getAccount(params.accountId);
          
          // Validate account data
          if (!isBrexAccount(account)) {
            throw new Error("Invalid account data received from Brex API");
          }
          
          // Get additional account information if available
          try {
            const transactions = await brexClient.getTransactions(params.accountId, undefined, 5);
            const recentActivity = transactions.items.slice(0, 5);
            
            // Combine account details with recent activity
            const enrichedAccount = {
              ...account,
              recent_activity: recentActivity
            };
            
            return {
              content: [{
                type: "text",
                text: JSON.stringify(enrichedAccount, null, 2)
              }]
            };
          } catch (transactionError) {
            // If we can't get transactions, just return the account details
            logError(`Error fetching recent transactions: ${transactionError instanceof Error ? transactionError.message : String(transactionError)}`);
            return {
              content: [{
                type: "text",
                text: JSON.stringify(account, null, 2)
              }]
            };
          }
        } catch (apiError) {
          logError(`Error calling Brex API: ${apiError instanceof Error ? apiError.message : String(apiError)}`);
          throw new Error(`Failed to get account details: ${apiError instanceof Error ? apiError.message : String(apiError)}`);
        }
      } catch (error) {
        logError(`Error in get_account_details tool: ${error instanceof Error ? error.message : String(error)}`);
        throw error;
      }
    });
  • MCP tool schema definition including name, description, and input schema for get_account_details, used in the list tools handler.
    name: "get_account_details",
    description: "Get detailed information about a Brex account",
    inputSchema: {
      type: "object",
      properties: {
        accountId: {
          type: "string",
          description: "ID of the Brex account"
        }
      },
      required: ["accountId"]
    }
  • Registers the get_account_details tool handler using registerToolHandler from index.ts.
    export function registerGetAccountDetails(_server: Server): void {
      registerToolHandler("get_account_details", async (request: ToolCallRequest) => {
        try {
          // Validate parameters
          const params = validateParams(request.params.arguments as unknown as Record<string, unknown>);
          logDebug(`Getting account details for account ${params.accountId}`);
          
          // Get Brex client
          const brexClient = getBrexClient();
          
          try {
            // Call Brex API to get account details
            const account = await brexClient.getAccount(params.accountId);
            
            // Validate account data
            if (!isBrexAccount(account)) {
              throw new Error("Invalid account data received from Brex API");
            }
            
            // Get additional account information if available
            try {
              const transactions = await brexClient.getTransactions(params.accountId, undefined, 5);
              const recentActivity = transactions.items.slice(0, 5);
              
              // Combine account details with recent activity
              const enrichedAccount = {
                ...account,
                recent_activity: recentActivity
              };
              
              return {
                content: [{
                  type: "text",
                  text: JSON.stringify(enrichedAccount, null, 2)
                }]
              };
            } catch (transactionError) {
              // If we can't get transactions, just return the account details
              logError(`Error fetching recent transactions: ${transactionError instanceof Error ? transactionError.message : String(transactionError)}`);
              return {
                content: [{
                  type: "text",
                  text: JSON.stringify(account, null, 2)
                }]
              };
            }
          } catch (apiError) {
            logError(`Error calling Brex API: ${apiError instanceof Error ? apiError.message : String(apiError)}`);
            throw new Error(`Failed to get account details: ${apiError instanceof Error ? apiError.message : String(apiError)}`);
          }
        } catch (error) {
          logError(`Error in get_account_details tool: ${error instanceof Error ? error.message : String(error)}`);
          throw error;
        }
      });
    } 
  • Calls registerGetAccountDetails to include the tool in the overall tools registration during server setup.
    registerGetAccountDetails(server);
  • Validates and types the input parameters for the get_account_details tool, ensuring accountId is present.
    function validateParams(input: any): GetAccountDetailsParams {
      if (!input) {
        throw new Error("Missing parameters");
      }
      
      if (!input.accountId) {
        throw new Error("Missing required parameter: accountId");
      }
      
      return {
        accountId: input.accountId
      };
    }
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 the action ('Get') but doesn't clarify if this is a read-only operation, what permissions are required, whether it returns real-time or cached data, or any rate limits. This is a significant gap for a tool that likely accesses sensitive account information.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple retrieval tool and front-loaded with the core action, making it easy to parse.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what 'detailed information' includes (e.g., balance, settings, transactions), the return format, or error handling. For a tool that likely returns structured account data, this leaves the agent with insufficient context to use it effectively.

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 input schema has 100% description coverage, with the 'accountId' parameter clearly documented. The description doesn't add any additional meaning beyond what the schema provides (e.g., format examples or sourcing guidance), so it meets the baseline for high schema coverage without compensating value.

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 resource ('detailed information about a Brex account'), making the purpose understandable. However, it doesn't explicitly differentiate from siblings like 'get_all_accounts' (which likely lists multiple accounts) or 'get_budget' (which focuses on budget data), leaving some ambiguity about scope.

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. It doesn't mention prerequisites (e.g., needing an account ID), exclusions, or compare to siblings like 'get_all_accounts' for bulk retrieval or 'get_budget' for financial details, leaving the agent to infer usage from context alone.

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