Skip to main content
Glama
crazyrabbitLTC

Brex MCP Server

get_spend_limit

Retrieve a specific spend limit by its ID to view current spending restrictions and budget allocations within the Brex financial platform.

Instructions

Get a spend limit by ID (read-only). Example: {"id":"sl_123"}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • Core handler logic for the 'get_spend_limit' tool: validates parameters, fetches the spend limit using BrexClient, formats response as JSON, and handles errors.
    registerToolHandler("get_spend_limit", async (request: ToolCallRequest) => {
      try {
        const params = validateParams(request.params.arguments);
        const client = getBrexClient();
        const spendLimit = await client.getSpendLimit(params.id);
        
        return { 
          content: [{ 
            type: "text", 
            text: JSON.stringify({ 
              spend_limit: spendLimit 
            }, null, 2) 
          }] 
        };
      } catch (error) {
        logError(`Error in get_spend_limit: ${error instanceof Error ? error.message : String(error)}`);
        throw error;
      }
    });
  • MCP tool schema definition for 'get_spend_limit', specifying input as object with required 'id' string field.
    {
      name: "get_spend_limit",
      description: "Get a spend limit by ID (read-only). Example: {\"id\":\"sl_123\"}",
      inputSchema: {
        type: "object",
        properties: {
          id: { type: "string" }
        },
        required: ["id"]
      }
    },
  • Local registration of the 'get_spend_limit' tool handler using registerToolHandler.
    export function registerGetSpendLimitById(_server: Server): void {
      registerToolHandler("get_spend_limit", async (request: ToolCallRequest) => {
        try {
          const params = validateParams(request.params.arguments);
          const client = getBrexClient();
          const spendLimit = await client.getSpendLimit(params.id);
          
          return { 
            content: [{ 
              type: "text", 
              text: JSON.stringify({ 
                spend_limit: spendLimit 
              }, null, 2) 
            }] 
          };
        } catch (error) {
          logError(`Error in get_spend_limit: ${error instanceof Error ? error.message : String(error)}`);
          throw error;
        }
      });
    }
  • Top-level invocation of registerGetSpendLimitById during tools registration.
    registerGetSpendLimitById(server);
  • TypeScript interface and validation function for tool input parameters.
    interface GetSpendLimitParams { 
      id: string; 
    }
    
    function validateParams(input: unknown): GetSpendLimitParams {
      const raw = (input || {}) as Record<string, unknown>;
      if (!raw.id) {
        throw new Error("Missing required parameter: id");
      }
      return { 
        id: String(raw.id) 
      };
    }

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