get_spend_limit
Retrieve spend limit details by ID to monitor budget allocations and track spending thresholds within the Brex financial platform.
Instructions
Get a spend limit by ID (read-only). Example: {"id":"sl_123"}
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/tools/getSpendLimitById.ts:28-48 (handler)Registers and implements the core handler logic for the 'get_spend_limit' tool. Validates input, calls BrexClient.getSpendLimit(id), formats response as JSON, handles errors.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; } }); }
- src/tools/getSpendLimitById.ts:14-26 (schema)Defines the input schema (GetSpendLimitParams interface) and validation logic for the tool's 'id' parameter.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) }; }
- src/tools/index.ts:123-133 (schema)Input schema for 'get_spend_limit' exposed in the list tools response.{ 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"] } },
- src/tools/index.ts:66-66 (registration)Registers the get_spend_limit tool by calling its registration function during server setup.registerGetSpendLimitById(server);
- src/tools/index.ts:27-27 (registration)Imports the tool's registration function.import { registerGetSpendLimitById } from "./getSpendLimitById.js";