Skip to main content
Glama
ekim197

Uber External Ads API MCP Server

by ekim197

update_campaign

Modify existing Uber advertising campaigns by updating campaign name, status, budget amount, or end time using the Uber External Ads API.

Instructions

Update an existing campaign

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ad_account_idYesThe ad account UUID
auth_tokenNoBearer token for authentication
campaign_dataYes
campaign_idYesThe campaign UUID

Implementation Reference

  • The core handler function for the 'update_campaign' tool. It validates inputs using Zod schemas, constructs the Uber Ads API PATCH URL, sends the request with axios, and returns the API response or handles errors.
    private async updateCampaign(args: any) { const authToken = this.getAuthToken(args.auth_token); const adAccountId = AdAccountIdSchema.parse(args.ad_account_id); const campaignId = CampaignIdSchema.parse(args.campaign_id); const campaignData = CampaignUpdateSchema.parse(args.campaign_data); const url = `${UBER_ADS_API_BASE_URL}/${adAccountId}/campaigns/${campaignId}`; try { const response = await axios.patch(url, campaignData, { headers: { 'Authorization': `Bearer ${authToken}`, 'Accept': 'application/json', 'Content-Type': 'application/json', }, }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return this.handleApiError(error); } }
  • Zod schema used for validating the campaign_data input parameter in the update_campaign handler.
    const CampaignUpdateSchema = z.object({ name: z.string().min(1).optional(), status: z.enum(['ACTIVE', 'PAUSED']).optional(), budget_amount: z.number().positive().optional(), end_time: z.string().optional(), });
  • src/index.ts:271-317 (registration)
    Tool registration in the listTools response, defining the name, description, and inputSchema for MCP clients.
    { name: 'update_campaign', description: 'Update an existing 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', }, campaign_data: { type: 'object', properties: { name: { type: 'string', description: 'Campaign name', }, status: { type: 'string', enum: ['ACTIVE', 'PAUSED'], description: 'Campaign status', }, budget_amount: { type: 'number', minimum: 0.01, description: 'Budget amount in USD', }, end_time: { type: 'string', description: 'Campaign end time (ISO 8601)', }, }, additionalProperties: false, }, }, required: ['ad_account_id', 'campaign_id', 'campaign_data'], additionalProperties: false, }, },
  • src/index.ts:420-421 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes 'update_campaign' calls to the updateCampaign method.
    case 'update_campaign': return await this.updateCampaign(args);
  • Zod schema for validating the campaign_id parameter.
    const CampaignIdSchema = z.string().min(1, 'Campaign ID is required');

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