delete_campaign
Remove an Uber advertising campaign by providing the ad account ID and campaign ID to permanently delete it from the Uber External Ads API.
Instructions
Delete a campaign
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ad_account_id | Yes | The ad account UUID | |
| auth_token | No | Bearer token for authentication | |
| campaign_id | Yes | The campaign UUID |
Implementation Reference
- src/index.ts:653-679 (handler)The core handler function for the 'delete_campaign' tool. It validates input using Zod schemas, constructs the API endpoint URL, performs a DELETE request to the Uber Ads API to delete the specified campaign, returns a success message on completion, or propagates errors via handleApiError.private async deleteCampaign(args: any) { const authToken = AuthTokenSchema.parse(args.auth_token); const adAccountId = AdAccountIdSchema.parse(args.ad_account_id); const campaignId = CampaignIdSchema.parse(args.campaign_id); const url = `${UBER_ADS_API_BASE_URL}/${adAccountId}/campaigns/${campaignId}`; try { const response = await axios.delete(url, { headers: { 'Authorization': `Bearer ${authToken}`, 'Accept': 'application/json', }, }); return { content: [ { type: 'text', text: `Campaign ${campaignId} deleted successfully`, }, ], }; } catch (error) { return this.handleApiError(error); } }
- src/index.ts:318-340 (registration)Registers the 'delete_campaign' tool in the list returned by ListToolsRequestHandler, specifying its name, description, and input schema for validation.{ name: 'delete_campaign', description: 'Delete a campaign', inputSchema: { type: 'object', properties: { auth_token: { type: 'string', description: 'Bearer token for authentication', }, ad_account_id: { type: 'string', description: 'The ad account UUID', }, campaign_id: { type: 'string', description: 'The campaign UUID', }, }, required: ['ad_account_id', 'campaign_id'], additionalProperties: false, }, },
- src/index.ts:321-339 (schema)Defines the input schema for the 'delete_campaign' tool, specifying properties (auth_token, ad_account_id, campaign_id) and required fields.inputSchema: { type: 'object', properties: { auth_token: { type: 'string', description: 'Bearer token for authentication', }, ad_account_id: { type: 'string', description: 'The ad account UUID', }, campaign_id: { type: 'string', description: 'The campaign UUID', }, }, required: ['ad_account_id', 'campaign_id'], additionalProperties: false, },
- src/index.ts:422-423 (registration)In the CallToolRequestHandler switch statement, registers and routes calls to the 'delete_campaign' tool by invoking the deleteCampaign handler method.case 'delete_campaign': return await this.deleteCampaign(args);
- src/index.ts:18-19 (schema)Zod schema for validating campaign_id input parameter used in the deleteCampaign handler.const CampaignIdSchema = z.string().min(1, 'Campaign ID is required');