get_campaign
Retrieve detailed information about a specific Uber advertising campaign using its unique identifier and ad account details.
Instructions
Get details for a specific 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:506-532 (handler)The handler function that implements the logic for the 'get_campaign' tool. It validates inputs, makes an API call to retrieve the specific campaign details from Uber Ads API, and returns the response as formatted JSON.private async getCampaign(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 url = `${UBER_ADS_API_BASE_URL}/${adAccountId}/campaigns/${campaignId}`; try { const response = await axios.get(url, { headers: { 'Authorization': `Bearer ${authToken}`, 'Accept': 'application/json', }, }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return this.handleApiError(error); } }
- src/index.ts:145-163 (schema)Input schema definition for the 'get_campaign' tool, specifying required parameters: ad_account_id and campaign_id, with optional auth_token.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:142-164 (registration)Registration of the 'get_campaign' tool in the ListToolsRequestHandler response, including name, description, and input schema.{ name: 'get_campaign', description: 'Get details for a specific 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:414-415 (registration)Dispatcher case in CallToolRequestHandler that routes 'get_campaign' calls to the getCampaign handler method.case 'get_campaign': return await this.getCampaign(args);
- src/index.ts:16-19 (schema)Zod validation schemas for ad_account_id and campaign_id inputs used in the getCampaign handler.const AdAccountIdSchema = z.string().min(1, 'Ad account ID is required'); const CampaignIdSchema = z.string().min(1, 'Campaign ID is required');