get_budget_program
Retrieve budget program details using its unique identifier to access spending limits, categories, and allocation information for financial planning and tracking.
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:26-44 (handler)Primary handler for the 'get_budget_program' tool: registers the tool handler, validates input parameters, fetches the budget program by ID using BrexClient, formats response as JSON, and handles errors.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; } }); }
- TypeScript interface and validation logic for tool input parameters requiring a string 'id'.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/index.ts:67-68 (registration)Registration of the get_budget_program tool (via registerGetBudgetProgramById) during overall tools registration in the MCP server setup.registerGetBudgetPrograms(server); registerGetBudgetProgramById(server);
- src/tools/index.ts:147-156 (schema)JSON schema for 'get_budget_program' input exposed in the MCP 'listTools' response.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"] } },
- Helper function to instantiate the BrexClient used for API calls in the tool handler.function getBrexClient(): BrexClient { return new BrexClient(); }