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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/tools/getBudgetProgramById.ts:27-43 (handler)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) }; }
- src/tools/getBudgetProgramById.ts:26-44 (registration)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; } }); }
- src/tools/index.ts:68-68 (registration)Top-level registration call within registerTools(server) that invokes the tool's register function.registerGetBudgetProgramById(server);
- src/tools/index.ts:147-156 (schema)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"] } },