Skip to main content
Glama

search_targeting_map

Map targeting IDs to their full details (names, types, paths). Use this when you have targeting IDs from other endpoints and need to resolve them.

Instructions

Map targeting IDs to their full details (names, types, paths). Useful for resolving IDs obtained from other endpoints.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targeting_listYesJSON array of targeting IDs to look up

Implementation Reference

  • The async handler function that executes the 'search_targeting_map' tool logic. It calls Meta's targetingsearchmap API endpoint with a JSON array of targeting IDs.
      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 };
        }
      }
    );
  • Input schema for the 'search_targeting_map' tool: expects a single 'targeting_list' parameter (string, described as JSON array of targeting IDs).
    {
      targeting_list: z.string().describe("JSON array of targeting IDs to look up"),
    },
  • Registration of the 'search_targeting_map' tool with the MCP server via server.tool(), including its name, description, input schema, and handler.
    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 };
        }
      }
    );
  • The AdsClient.get() method used by the handler to call the Meta Ads API.
    async get(
      path: string,
      params?: Record<string, unknown>
    ): Promise<ClientResponse> {
      return this.request("GET", path, params);
    }
  • src/index.ts:62-62 (registration)
    Top-level registration call in index.ts that registers targeting tools (including 'search_targeting_map') with the main server.
    registerTargetingTools(server, client);
Behavior3/5

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

No annotations are provided, so the description must carry the burden. It describes the mapping action but does not disclose error handling, rate limits, or authorization needs. However, it is likely a safe read operation.

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

Conciseness5/5

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

Two sentences, no fluff. Front-loaded with the action 'Map targeting IDs to their full details', making it immediately understandable.

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

Completeness4/5

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

For a simple lookup tool with one parameter and no output schema, the description covers the purpose and usage context. Could be improved with an example or mention of constraints, but overall adequate.

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

Parameters4/5

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

The schema already describes the parameter as a JSON array of IDs. The description adds value by explaining the output (names, types, paths) and the purpose of resolving IDs.

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 the tool maps targeting IDs to full details (names, types, paths), distinguishing it from sibling tools like search_targeting and search_locations which serve different purposes.

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

Usage Guidelines4/5

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

The description provides clear context by stating it is useful for resolving IDs obtained from other endpoints, but does not explicitly mention when not to use or alternative tools.

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