Skip to main content
Glama
crazyrabbitLTC

Brex MCP Server

get_spend_limits

Retrieve and view current spend limit configurations for Brex accounts to monitor budget allocations and status.

Instructions

List spend limits (read-only). Example: {"limit":10,"status":"ACTIVE"}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
cursorNo
parent_budget_idNo
statusNo
member_user_idNo

Implementation Reference

  • Executes the get_spend_limits tool: validates params, calls Brex API, returns formatted JSON response.
    registerToolHandler("get_spend_limits", async (request: ToolCallRequest) => {
      try {
        const params = validateParams(request.params.arguments);
        const client = getBrexClient();
        const apiParams: SpendLimitListParams = {
          limit: params.limit,
          cursor: params.cursor,
          parent_budget_id: params.parent_budget_id,
          status: params.status,
          member_user_id: params.member_user_id
        };
        const resp = await client.getSpendLimits(apiParams);
        const items = Array.isArray(resp.items) ? resp.items : [];
        return { content: [{ type: "text", text: JSON.stringify({ spend_limits: items, meta: { count: items.length, next_cursor: resp.next_cursor } }, null, 2) }] };
      } catch (error) {
        logError(`Error in get_spend_limits: ${error instanceof Error ? error.message : String(error)}`);
        throw error;
      }
    });
  • JSON schema for get_spend_limits tool inputs in the listTools handler response.
    {
      name: "get_spend_limits",
      description: "List spend limits (read-only). Example: {\"limit\":10,\"status\":\"ACTIVE\"}",
      inputSchema: {
        type: "object",
        properties: {
          limit: { type: "number" },
          cursor: { type: "string" },
          parent_budget_id: { type: "string" },
          status: { type: "string", enum: ["ACTIVE","ARCHIVED"] },
          member_user_id: { type: "string" }
        }
      }
    },
  • Registers the get_spend_limits tool handler using registerToolHandler.
    export function registerGetSpendLimits(_server: Server): void {
      registerToolHandler("get_spend_limits", async (request: ToolCallRequest) => {
        try {
          const params = validateParams(request.params.arguments);
          const client = getBrexClient();
          const apiParams: SpendLimitListParams = {
            limit: params.limit,
            cursor: params.cursor,
            parent_budget_id: params.parent_budget_id,
            status: params.status,
            member_user_id: params.member_user_id
          };
          const resp = await client.getSpendLimits(apiParams);
          const items = Array.isArray(resp.items) ? resp.items : [];
          return { content: [{ type: "text", text: JSON.stringify({ spend_limits: items, meta: { count: items.length, next_cursor: resp.next_cursor } }, null, 2) }] };
        } catch (error) {
          logError(`Error in get_spend_limits: ${error instanceof Error ? error.message : String(error)}`);
          throw error;
        }
      });
    }
  • Validates and parses input parameters for the get_spend_limits tool.
    function validateParams(input: unknown): GetSpendLimitsParams {
      const raw = (input || {}) as Record<string, unknown>;
      const out: GetSpendLimitsParams = {};
      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.cursor !== undefined) out.cursor = String(raw.cursor);
      if (raw.parent_budget_id !== undefined) out.parent_budget_id = String(raw.parent_budget_id);
      if (raw.status !== undefined) out.status = String(raw.status) as SpendLimitStatus;
      if (raw.member_user_id !== undefined) out.member_user_id = String(raw.member_user_id);
      return out;
    }
  • TypeScript interface defining typed parameters for get_spend_limits.
    interface GetSpendLimitsParams {
      limit?: number;
      cursor?: string;
      parent_budget_id?: string;
      status?: SpendLimitStatus;
      member_user_id?: string;
    }

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