Skip to main content
Glama
ekim197

Uber External Ads API MCP Server

by ekim197

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
NameRequiredDescriptionDefault
ad_account_idYesThe ad account UUID
auth_tokenNoBearer token for authentication
campaign_idYesThe campaign UUID

Implementation Reference

  • 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,
      },
    },
  • 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);
  • Zod schema for validating campaign_id input parameter used in the deleteCampaign handler.
    const CampaignIdSchema = z.string().min(1, 'Campaign ID is required');

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ekim197/HACKATHON_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server