create_budget_schedule
Create a scheduled budget for your ad account by setting amount, type, and time range. Define absolute or multiplier values with start and end times.
Instructions
Create a new ad budget schedule for the ad account.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| budget_value | Yes | Budget amount in account currency cents | |
| budget_value_type | Yes | Budget value type (e.g. ABSOLUTE, MULTIPLIER) | |
| time_start | Yes | Schedule start time (ISO 8601 or Unix timestamp) | |
| time_end | Yes | Schedule end time (ISO 8601 or Unix timestamp) |
Implementation Reference
- src/tools/budget.ts:29-53 (handler)The handler for the 'create_budget_schedule' tool. It receives budget_value, budget_value_type, time_start, and time_end, then POSTs to the Meta Ads API endpoint /act_{accountId}/adbudgetschedules.
// ─── create_budget_schedule ─────────────────────────────────── server.tool( "create_budget_schedule", "Create a new ad budget schedule for the ad account.", { budget_value: z.string().describe("Budget amount in account currency cents"), budget_value_type: z.string().describe("Budget value type (e.g. ABSOLUTE, MULTIPLIER)"), time_start: z.string().describe("Schedule start time (ISO 8601 or Unix timestamp)"), time_end: z.string().describe("Schedule end time (ISO 8601 or Unix timestamp)"), }, async ({ budget_value, budget_value_type, time_start, time_end }) => { try { const params: Record<string, unknown> = { budget_value, budget_value_type, time_start, time_end, }; const { data, rateLimit } = await client.post(`${client.accountPath}/adbudgetschedules`, params); return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } ); - src/tools/budget.ts:33-38 (schema)Input schema for create_budget_schedule, defined as Zod object with four required fields: budget_value (string), budget_value_type (string), time_start (string), time_end (string).
{ budget_value: z.string().describe("Budget amount in account currency cents"), budget_value_type: z.string().describe("Budget value type (e.g. ABSOLUTE, MULTIPLIER)"), time_start: z.string().describe("Schedule start time (ISO 8601 or Unix timestamp)"), time_end: z.string().describe("Schedule end time (ISO 8601 or Unix timestamp)"), }, - src/tools/budget.ts:30-53 (registration)Registration of 'create_budget_schedule' via server.tool() in the registerBudgetTools function. The tool is exported and called from src/index.ts at line 82.
server.tool( "create_budget_schedule", "Create a new ad budget schedule for the ad account.", { budget_value: z.string().describe("Budget amount in account currency cents"), budget_value_type: z.string().describe("Budget value type (e.g. ABSOLUTE, MULTIPLIER)"), time_start: z.string().describe("Schedule start time (ISO 8601 or Unix timestamp)"), time_end: z.string().describe("Schedule end time (ISO 8601 or Unix timestamp)"), }, async ({ budget_value, budget_value_type, time_start, time_end }) => { try { const params: Record<string, unknown> = { budget_value, budget_value_type, time_start, time_end, }; const { data, rateLimit } = await client.post(`${client.accountPath}/adbudgetschedules`, params); return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } ); - src/index.ts:82-82 (registration)Entry point where registerBudgetTools is called with the real server and client, which registers the create_budget_schedule tool.
registerBudgetTools(server, client); - src/services/ads-client.ts:187-199 (helper)The AdsClient.post() helper method used by the handler to POST to /adbudgetschedules endpoint. Delegates to the private request() method.
async post( path: string, params?: Record<string, unknown> ): Promise<ClientResponse> { return this.request("POST", path, params); } async delete( path: string, params?: Record<string, unknown> ): Promise<ClientResponse> { return this.request("DELETE", path, params); }