delete_campaign
Hard-delete a campaign along with its ad sets and ads from Meta Ads. Use this to permanently remove campaigns, but consider archiving instead to preserve historical data.
Instructions
WRITE: Hard-delete a campaign (and its ad sets / ads). Prefer update_campaign with status=ARCHIVED if you want to keep historical data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| campaign_id | Yes |
Implementation Reference
- src/tools/campaigns.ts:158-158 (handler)The handler function for delete_campaign that calls metaDelete with the campaign ID
handler: async (args) => metaDelete(`/${String(args.campaign_id)}`), - src/tools/campaigns.ts:155-157 (schema)Input schema for delete_campaign requiring a campaign_id string
inputSchema: { campaign_id: z.string(), }, - src/tools/campaigns.ts:150-159 (registration)Tool registration definition within the campaignTools array
{ name: "delete_campaign", description: "WRITE: Hard-delete a campaign (and its ad sets / ads). Prefer update_campaign with " + "status=ARCHIVED if you want to keep historical data.", inputSchema: { campaign_id: z.string(), }, handler: async (args) => metaDelete(`/${String(args.campaign_id)}`), }, - src/client.ts:194-210 (helper)The metaDelete helper function that performs the actual DELETE request to Meta's Graph API
export async function metaDelete<T = unknown>(path: string): Promise<T> { const qs = new URLSearchParams(); qs.append("access_token", getCurrentToken()); const url = `${META_API_BASE}${normalizePath(path)}?${qs.toString()}`; const res = await fetch(url, { method: "DELETE" }); if (!res.ok) { const text = await res.text().catch(() => ""); throw new Error(enhanceMetaError(res.status, text)); } const raw = await res.text(); if (!raw) return {} as T; try { return JSON.parse(raw) as T; } catch { return raw as unknown as T; }