Skip to main content
Glama

get_ad

Retrieve details of a specific ad by providing its ID and optional fields.

Instructions

Get details of a specific ad by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ad_idYesAd ID
fieldsNoComma-separated fields to return

Implementation Reference

  • The get_ad tool handler: calls the Facebook Ads API via client.get with the ad ID and optional fields, returns ad details as JSON.
    // ─── get_ad ────────────────────────────────────────────────
    server.tool(
      "get_ad",
      "Get details of a specific ad by ID.",
      {
        ad_id: z.string().describe("Ad ID"),
        fields: z.string().optional().describe("Comma-separated fields to return"),
      },
      async ({ ad_id, fields }) => {
        try {
          const params: Record<string, unknown> = {};
          if (fields) params.fields = fields;
          const { data, rateLimit } = await client.get(`/${ad_id}`, 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 };
        }
      }
    );
  • Input schema for get_ad: requires ad_id (string) and optional fields (string).
    {
      ad_id: z.string().describe("Ad ID"),
      fields: z.string().optional().describe("Comma-separated fields to return"),
    },
  • src/index.ts:52-52 (registration)
    Registration of registerAdTools which includes the get_ad tool.
    registerAdTools(server, client);
  • src/tools/ads.ts:36-37 (registration)
    Tool registration via server.tool('get_ad', ...) in the registerAdTools function.
    server.tool(
      "get_ad",

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

A3.9/5.0
Behavior3/5

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

The verb 'Get' implies a read-only operation, but with no annotations, the description carries the full burden. It does not disclose what fields are returned by default, error behavior, or that it returns a single object. No side effects are mentioned, but the verb suggests none.

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?

The description is a single, front-loaded sentence with no filler words. It is appropriately concise for a simple getter operation.

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?

The tool is simple with well-documented parameters, but the description lacks context about what 'details' includes, how the fields parameter affects the response, and how it differs from sibling getters like get_campaign_ads. Without an output schema, the description could be more explicit about the return shape.

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 schema provides 100% coverage for both parameters (ad_id and fields), so the description need not repeat them. It adds no extra meaning beyond the schema, such as examples or constraints, but the baseline is 3 given the high schema coverage.

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 action ('Get'), the resource ('details of a specific ad'), and the identifier ('by ID'). It distinguishes this from sibling list tools like list_ads and get_campaign_ads by emphasizing a single ad lookup.

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 implies usage when you have a specific ad ID and need its details, which is clear context. However, it does not explicitly mention alternatives or when not to use it, such as using list_ads for multiple ads. No exclusions are stated.

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

Deploy Server

Other Tools