delete_budget_schedule
Remove a budget schedule permanently. This action cannot be undone.
Instructions
Delete a budget schedule. This action is irreversible.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schedule_id | Yes | Budget schedule ID to delete |
Implementation Reference
- src/tools/budget.ts:79-94 (handler)The handler function for the 'delete_budget_schedule' tool. Takes a schedule_id parameter, sends a DELETE request to the Meta Ads API via client.delete(`/${schedule_id}`), and returns a success response. The tool description is 'Delete a budget schedule. This action is irreversible.'
// ─── delete_budget_schedule ─────────────────────────────────── server.tool( "delete_budget_schedule", "Delete a budget schedule. This action is irreversible.", { schedule_id: z.string().describe("Budget schedule ID to delete"), }, async ({ schedule_id }) => { try { const { data, rateLimit } = await client.delete(`/${schedule_id}`); return { content: [{ type: "text" as const, text: JSON.stringify({ success: true, ...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:83-84 (schema)Input schema for 'delete_budget_schedule' — requires a single 'schedule_id' string parameter describing the budget schedule ID to delete.
{ schedule_id: z.string().describe("Budget schedule ID to delete"), - src/tools/budget.ts:80-82 (registration)Registration of the 'delete_budget_schedule' tool via server.tool() with the name 'delete_budget_schedule' inside the registerBudgetTools function.
server.tool( "delete_budget_schedule", "Delete a budget schedule. This action is irreversible.", - src/services/ads-client.ts:194-199 (helper)The AdsClient.delete() helper method used by the handler. Delegates to the internal request() method with method 'DELETE', appending parameters as query string.
async delete( path: string, params?: Record<string, unknown> ): Promise<ClientResponse> { return this.request("DELETE", path, params); } - src/tools/budget.ts:5-95 (registration)The registerBudgetTools function that registers all budget tools (including delete_budget_schedule) on the MCP server. Called from src/index.ts at line 82.
export function registerBudgetTools(server: McpServer, client: AdsClient): void { // ─── list_budget_schedules ──────────────────────────────────── server.tool( "list_budget_schedules", "List ad budget schedules for the ad account. Returns paginated results.", { fields: z.string().optional().describe("Comma-separated fields to return"), limit: z.number().optional().default(25).describe("Number of results (default 25)"), after: z.string().optional().describe("Pagination cursor for next page"), }, async ({ fields, limit, after }) => { try { const params: Record<string, unknown> = {}; if (fields) params.fields = fields; if (limit) params.limit = limit; if (after) params.after = after; const { data, rateLimit } = await client.get(`${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 }; } } ); // ─── 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 }; } } ); // ─── 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 }; } } ); // ─── delete_budget_schedule ─────────────────────────────────── server.tool( "delete_budget_schedule", "Delete a budget schedule. This action is irreversible.", { schedule_id: z.string().describe("Budget schedule ID to delete"), }, async ({ schedule_id }) => { try { const { data, rateLimit } = await client.delete(`/${schedule_id}`); return { content: [{ type: "text" as const, text: JSON.stringify({ success: true, ...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 }; } } ); }