Skip to main content
Glama
crazyrabbitLTC

Brex MCP Server

get_budget_program

Retrieve budget program details from Brex by specifying a program ID to access financial planning information.

Instructions

Get a budget program by ID (read-only). Example: {"id":"bp_123"}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • Main handler logic for the 'get_budget_program' tool: validates parameters, fetches budget program by ID using BrexClient, formats response as JSON.
    registerToolHandler("get_budget_program", async (request: ToolCallRequest) => {
      try {
        const params = validateParams(request.params.arguments);
        const client = getBrexClient();
        const program = await client.getBudgetProgram(params.id);
        
        return { 
          content: [{ 
            type: "text", 
            text: JSON.stringify({ budget_program: program }, null, 2) 
          }] 
        };
      } catch (error) {
        logError(`Error in get_budget_program: ${error instanceof Error ? error.message : String(error)}`);
        throw error;
      }
    });
  • Type definition and validation for input parameters (requires 'id' as string).
    interface GetBudgetProgramParams { 
      id: string; 
    }
    
    function validateParams(input: unknown): GetBudgetProgramParams {
      const raw = (input || {}) as Record<string, unknown>;
      if (!raw.id) throw new Error("Missing required parameter: id");
      return { 
        id: String(raw.id) 
      };
    }
  • Local registration function that sets up the tool handler using registerToolHandler.
    export function registerGetBudgetProgramById(_server: Server): void {
      registerToolHandler("get_budget_program", async (request: ToolCallRequest) => {
        try {
          const params = validateParams(request.params.arguments);
          const client = getBrexClient();
          const program = await client.getBudgetProgram(params.id);
          
          return { 
            content: [{ 
              type: "text", 
              text: JSON.stringify({ budget_program: program }, null, 2) 
            }] 
          };
        } catch (error) {
          logError(`Error in get_budget_program: ${error instanceof Error ? error.message : String(error)}`);
          throw error;
        }
      });
    }
  • Top-level registration call within registerTools(server) that invokes the tool's register function.
    registerGetBudgetProgramById(server);
  • Input schema exposed in the listTools response for the MCP protocol.
      name: "get_budget_program",
      description: "Get a budget program by ID (read-only). Example: {\"id\":\"bp_123\"}",
      inputSchema: {
        type: "object",
        properties: {
          id: { type: "string" }
        },
        required: ["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