update_budget_schedule
Modify specific fields of an existing budget schedule, such as budget amount, start time, or end time, without affecting other settings.
Instructions
Update an existing budget schedule. Only provided fields will be modified.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schedule_id | Yes | Budget schedule ID to update | |
| budget_value | No | New budget amount in account currency cents | |
| time_start | No | New schedule start time | |
| time_end | No | New schedule end time |
Implementation Reference
- src/tools/budget.ts:55-77 (handler)The update_budget_schedule tool handler: takes schedule_id (required), and optional budget_value, time_start, time_end fields. Sends a POST request to /{schedule_id} with only the provided fields to update. Returns the API response or an error.
// ─── update_budget_schedule ─────────────────────────────────── server.tool( "update_budget_schedule", "Update an existing budget schedule. Only provided fields will be modified.", { schedule_id: z.string().describe("Budget schedule ID to update"), budget_value: z.string().optional().describe("New budget amount in account currency cents"), time_start: z.string().optional().describe("New schedule start time"), time_end: z.string().optional().describe("New schedule end time"), }, async ({ schedule_id, budget_value, time_start, time_end }) => { try { const params: Record<string, unknown> = {}; if (budget_value) params.budget_value = budget_value; if (time_start) params.time_start = time_start; if (time_end) params.time_end = time_end; const { data, rateLimit } = await client.post(`/${schedule_id}`, 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:59-64 (schema)Zod schema for update_budget_schedule input: schedule_id (required string), budget_value (optional string), time_start (optional string), time_end (optional string).
{ schedule_id: z.string().describe("Budget schedule ID to update"), budget_value: z.string().optional().describe("New budget amount in account currency cents"), time_start: z.string().optional().describe("New schedule start time"), time_end: z.string().optional().describe("New schedule end time"), }, - src/tools/budget.ts:5-5 (registration)The registerBudgetTools function registers all budget tools including update_budget_schedule via server.tool().
export function registerBudgetTools(server: McpServer, client: AdsClient): void { - src/index.ts:82-82 (registration)Where registerBudgetTools is called in the main server setup to register all budget tools (including update_budget_schedule).
registerBudgetTools(server, client); - src/services/ads-client.ts:187-192 (helper)The AdsClient.post() helper method used by the update_budget_schedule handler to send the POST request to the Meta Ads API.
async post( path: string, params?: Record<string, unknown> ): Promise<ClientResponse> { return this.request("POST", path, params); }