Skip to main content
Glama
ekim197

Uber External Ads API MCP Server

by ekim197

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

Implementation Reference

  • 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);
      }
    }
  • 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);
  • 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');

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