Skip to main content
Glama
ZLeventer

google-ads-mcp

gads_campaign_audience_targeting

Retrieve audience targeting details for Google Ads campaigns, including targeting type (observation or targeting) and bid modifiers. View both included and excluded audience lists to optimize campaign performance.

Instructions

Audiences attached to campaigns with targeting setting (observation vs targeting) and bid modifier. Shows both inclusion and exclusion lists.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customer_idNoOverride GOOGLE_ADS_CUSTOMER_ID for this call
campaign_idNoFilter to a specific campaign ID

Implementation Reference

  • The main handler function that queries the Google Ads API for audience targeting (campaign_criterion with type USER_LIST) attached to campaigns. Accepts optional customer_id and campaign_id filter, returns rows with criterion_id, bid_modifier, negative flag, and user_list info, ordered by campaign name (limited to 500).
    export async function campaignAudienceTargeting(args: z.infer<z.ZodObject<typeof campaignAudienceTargetingSchema>>) {
      const customer = getCustomer(args.customer_id);
      const campaignClause = args.campaign_id ? `AND campaign.id = ${args.campaign_id}` : "";
      const rows = await customer.query(`
        SELECT
          campaign.id,
          campaign.name,
          campaign_criterion.criterion_id,
          campaign_criterion.type,
          campaign_criterion.bid_modifier,
          campaign_criterion.negative,
          campaign_criterion.user_list.user_list
        FROM campaign_criterion
        WHERE campaign_criterion.type = 'USER_LIST'
          AND campaign_criterion.status != 'REMOVED'
          ${campaignClause}
        ORDER BY campaign.name
        LIMIT 500
      `);
      return { rowCount: rows.length, rows };
    }
  • Zod schema for the gads_campaign_audience_targeting tool. Defines two optional string inputs: customer_id (to override the default Google Ads customer) and campaign_id (to filter to a specific campaign).
    export const campaignAudienceTargetingSchema = {
      customer_id: z.string().optional().describe("Override GOOGLE_ADS_CUSTOMER_ID for this call"),
      campaign_id: z.string().optional().describe("Filter to a specific campaign ID"),
    };
  • src/index.ts:174-179 (registration)
    Registration of the tool with the MCP server under the name 'gads_campaign_audience_targeting', with a description, schema, and async handler that catches errors via the ok/err pattern.
    server.tool(
      "gads_campaign_audience_targeting",
      "Audiences attached to campaigns with targeting setting (observation vs targeting) and bid modifier. Shows both inclusion and exclusion lists.",
      campaignAudienceTargetingSchema,
      async (args) => { try { return ok(await campaignAudienceTargeting(args)); } catch (e) { return err(e); } }
    );
  • The getCustomer helper function used by the handler to create a Google Ads API Customer client, resolving the customer_id from the argument or environment variable.
    export function getCustomer(override?: string): Customer {
      const refresh_token = process.env.GOOGLE_ADS_REFRESH_TOKEN;
      if (!refresh_token) throw new GoogleAdsError("GOOGLE_ADS_REFRESH_TOKEN is not set");
      const customer_id = (override ?? process.env.GOOGLE_ADS_CUSTOMER_ID ?? "").replace(/-/g, "");
      if (!customer_id) throw new GoogleAdsError("GOOGLE_ADS_CUSTOMER_ID is not set and no customer_id was passed");
      const login_customer_id = process.env.GOOGLE_ADS_LOGIN_CUSTOMER_ID?.replace(/-/g, "") || undefined;
      return getApi().Customer({ customer_id, login_customer_id, refresh_token });
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must convey behavioral traits. It indicates a read operation (shows lists) and details the returned fields (targeting setting, bid modifier, inclusion/exclusion). However, it does not mention what happens if parameters are omitted, error handling, or any side effects. This is adequate but incomplete.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that efficiently conveys the tool's purpose and key output details. It is front-loaded and does not include redundant information, though it could be slightly restructured for readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description should explain return values adequately. It mentions audiences, targeting setting, bid modifier, and lists (inclusion/exclusion), which provides a good overview. However, it does not specify whether results are scoped to all campaigns or require a campaign_id, nor does it detail the format or additional fields like audience names or IDs. This leaves some ambiguity for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Both parameters (customer_id and campaign_id) are described in the schema with clear purposes. The description does not add new meaning beyond the schema, but since schema coverage is 100%, a baseline of 3 is appropriate. No additional constraints or formatting details are provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it retrieves audiences attached to campaigns, specifying the targeting setting (observation vs targeting) and bid modifier, and mentions both inclusion and exclusion lists. It distinguishes itself from sibling tools like gads_list_audiences which likely list all audiences, and gads_list_campaigns which list campaigns, by focusing on the campaign-audience association with additional details.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not provide explicit guidance on when to use this tool versus alternatives, nor does it mention prerequisites or exclusions. It is adequate but lacks explicit when-to-use or when-not-to-use context, relying on the user to infer from the tool name and siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/ZLeventer/google-ads-mcp'

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