Skip to main content
Glama

get_targeting_suggestions

Generates targeting suggestions such as interests, behaviors, and demographics based on your current ad targeting criteria to expand your audience reach.

Instructions

Get targeting suggestions based on existing targeting criteria. Meta suggests related interests, behaviors, and demographics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targeting_listYesJSON string of current targeting criteria to get suggestions for

Implementation Reference

  • The handler function for get_targeting_suggestions tool. Sends a GET request to the Meta API's targetingsuggestions endpoint with the provided targeting_list, then returns the response data (with rate limit info) as formatted JSON. On failure, returns an error message.
    // ─── get_targeting_suggestions ─────────────────────────────
    server.tool(
      "get_targeting_suggestions",
      "Get targeting suggestions based on existing targeting criteria. Meta suggests related interests, behaviors, and demographics.",
      {
        targeting_list: z.string().describe("JSON string of current targeting criteria to get suggestions for"),
      },
      async ({ targeting_list }) => {
        try {
          const { data, rateLimit } = await client.get(`${client.accountPath}/targetingsuggestions`, { targeting_list });
          return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • Input schema for get_targeting_suggestions. Expects a single required parameter: targeting_list (string) - a JSON string of current targeting criteria.
    {
      targeting_list: z.string().describe("JSON string of current targeting criteria to get suggestions for"),
  • src/index.ts:61-62 (registration)
    Registration of the registerTargetingTools function which registers all targeting tools (including get_targeting_suggestions) on the MCP server.
    registerAudienceTools(server, client);
    registerTargetingTools(server, client);
  • The registerTargetingTools function wraps all targeting tool registrations, including get_targeting_suggestions, onto the MCP server.
    export function registerTargetingTools(server: McpServer, client: AdsClient): void {
      // ─── search_targeting ──────────────────────────────────────
      server.tool(
        "search_targeting",
        "Search for targeting options (interests, behaviors, demographics, etc.) by keyword. Use this to find valid targeting IDs for ad set targeting specs.",
        {
          q: z.string().describe("Search query (e.g. 'fitness', 'technology', 'cooking')"),
          type: z.string().optional().describe("Targeting type filter: adinterest, adgeolocation, adeducationschool, adeducationmajor, adworkemployer, adworkposition, adlocale, etc."),
          limit: z.number().optional().default(25).describe("Number of results (default 25)"),
        },
        async ({ q, type, limit }) => {
          try {
            const params: Record<string, unknown> = { q };
            if (type) params.type = type;
            if (limit) params.limit = limit;
            const { data, rateLimit } = await client.get(`${client.accountPath}/targetingsearch`, params);
            return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
          } catch (error) {
            return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
          }
        }
      );
    
      // ─── search_locations ──────────────────────────────────────
      server.tool(
        "search_locations",
        "Search for geographic locations (countries, regions, cities, zip codes) for ad targeting.",
        {
          q: z.string().describe("Search query (e.g. 'New York', 'California', 'United States')"),
          location_types: z.string().optional().describe("Comma-separated location types: country, region, city, zip, geo_market, electoral_district"),
          limit: z.number().optional().default(25).describe("Number of results (default 25)"),
        },
        async ({ q, location_types, limit }) => {
          try {
            const params: Record<string, unknown> = { q, type: "adgeolocation" };
            if (location_types) params.location_types = location_types;
            if (limit) params.limit = limit;
            const { data, rateLimit } = await client.get(`/search`, params);
            return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
          } catch (error) {
            return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
          }
        }
      );
    
      // ─── search_targeting_map ──────────────────────────────────
      server.tool(
        "search_targeting_map",
        "Map targeting IDs to their full details (names, types, paths). Useful for resolving IDs obtained from other endpoints.",
        {
          targeting_list: z.string().describe("JSON array of targeting IDs to look up"),
        },
        async ({ targeting_list }) => {
          try {
            const { data, rateLimit } = await client.get(`${client.accountPath}/targetingsearchmap`, { targeting_list });
            return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
          } catch (error) {
            return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
          }
        }
      );
    
      // ─── get_reach_estimate ────────────────────────────────────
      server.tool(
        "get_reach_estimate",
        "Get estimated audience reach for a given targeting specification. Useful for planning campaigns before creating them.",
        {
          targeting_spec: z.string().describe("JSON string of targeting spec (same format as ad set targeting)"),
        },
        async ({ targeting_spec }) => {
          try {
            const { data, rateLimit } = await client.get(`${client.accountPath}/reachestimate`, { targeting_spec });
            return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
          } catch (error) {
            return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
          }
        }
      );
    
      // ─── get_targeting_suggestions ─────────────────────────────
      server.tool(
        "get_targeting_suggestions",
        "Get targeting suggestions based on existing targeting criteria. Meta suggests related interests, behaviors, and demographics.",
        {
          targeting_list: z.string().describe("JSON string of current targeting criteria to get suggestions for"),
        },
        async ({ targeting_list }) => {
          try {
            const { data, rateLimit } = await client.get(`${client.accountPath}/targetingsuggestions`, { targeting_list });
            return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
          } catch (error) {
            return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
          }
        }
      );
    }
  • Reference to get_targeting_suggestions in the audience_builder prompt, instructing the AI to use it to discover related targeting options.
    "2. Use get_targeting_suggestions to discover related targeting options I might have missed",
    "3. Use get_reach_estimate to check the audience size for the combined targeting",
Behavior2/5

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

No annotations are provided, and the description does not disclose important behavioral traits such as whether the tool is read-only, required permissions, rate limits, or side effects. The mention of 'Meta suggests' implies a read operation, but this is not explicit.

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 brief with two clear sentences, no extraneous information. It is appropriately concise, though a bit more structure (e.g., listing input/output format) could improve usability.

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

Completeness2/5

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

Given the lack of output schema and annotations, the description does not fully compensate. It omits details on how to format the targeting criteria, what the output looks like, and any limitations (e.g., maximum input size). The tool's behavior is underspecified for effective use.

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?

The input schema has 100% description coverage on the single parameter 'targeting_list', explaining it as a JSON string of current criteria. The tool description adds no additional meaning beyond what the schema already provides, so a baseline score of 3 is appropriate.

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

Purpose4/5

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

The description clearly states the tool gets targeting suggestions based on existing criteria, and specifies the types (interests, behaviors, demographics). However, it does not differentiate from sibling tools like search_targeting, which may offer similar functionality.

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

Usage Guidelines2/5

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

No guidance on when to use this tool over alternatives (e.g., search_targeting) or when not to use it. The description only explains what it does, not its appropriate use cases.

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/mikusnuz/meta-ads-mcp'

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