Skip to main content
Glama

get_budgets

Retrieve and list budget information from the Brex financial platform, including active, archived, or draft budgets with pagination support.

Instructions

List budgets (read-only). Example: {"limit":10}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNo
limitNo
parent_budget_idNo
spend_budget_statusNo

Implementation Reference

  • Core handler function for the 'get_budgets' tool. Validates input parameters, calls the Brex API via client.getBudgets, processes the response, and returns formatted JSON output.
    registerToolHandler("get_budgets", async (request: ToolCallRequest) => { try { const params = validateParams(request.params.arguments); const client = getBrexClient(); const apiParams: BudgetListParams = { limit: params.limit, cursor: params.cursor, parent_budget_id: params.parent_budget_id, spend_budget_status: params.spend_budget_status }; const resp = await client.getBudgets(apiParams); const items = Array.isArray(resp.items) ? resp.items : []; return { content: [{ type: "text", text: JSON.stringify({ budgets: items, meta: { count: items.length, next_cursor: resp.next_cursor || null } }, null, 2) }] }; } catch (error) { logError(`Error in get_budgets: ${error instanceof Error ? error.message : String(error)}`); throw error; } });
  • Type definition (GetBudgetsParams interface) and validation logic for tool input parameters.
    interface GetBudgetsParams { limit?: number; cursor?: string; parent_budget_id?: string; spend_budget_status?: SpendBudgetStatus; } function validateParams(input: unknown): GetBudgetsParams { const raw = (input || {}) as Record<string, unknown>; const out: GetBudgetsParams = {}; 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.spend_budget_status !== undefined) out.spend_budget_status = String(raw.spend_budget_status) as SpendBudgetStatus; return out; }
  • Registers the get_budgets tool by calling registerGetBudgets(server).
    registerGetBudgets(server);
  • Official MCP input schema definition for the 'get_budgets' tool, exposed in the listTools response.
    name: "get_budgets", description: "List budgets (read-only). Example: {\"limit\":10}", inputSchema: { type: "object", properties: { limit: { type: "number" }, cursor: { type: "string" }, parent_budget_id: { type: "string" }, spend_budget_status: { type: "string", enum: ["ACTIVE","ARCHIVED","DRAFT"] } } } },
  • Imports the registerGetBudgets function used to register the tool.
    import { registerGetBudgets } from "./getBudgets.js";

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