Skip to main content
Glama

Search ads

search_ads
Read-onlyIdempotent

Search the public Meta Ad Library (Facebook, Instagram, Messenger, Audience Network, Threads) for ads by keyword and/or advertiser.

    Cost: 1 credit per call, whatever the number of ads returned (an empty result too);
    an error costs 0. `limit` (max 30, one page of the Ad Library) does not change the cost:
    keep it small only to keep the answer short. The next page is a new call (1 credit).

    Args:
        query: Keyword or phrase (1-100 chars). Required unless page_id is given.
        page_id: Restrict to one advertiser (numeric page ID, see search_pages).
        country: ISO-3166 alpha-2 country where the ads ran (e.g. 'IT', 'US') or 'ALL'.
        status: 'active' (default), 'inactive' or 'all'.
        ad_type: 'all' or 'political' (political & issue ads, with spend/impressions).
        media_type: 'all', 'image', 'video', 'meme' or 'none'.
        platforms: Subset of facebook, instagram, messenger, audience_network, threads.
        languages: ISO-639-1 language codes of the ad text (e.g. ['it', 'en']).
        active_from: YYYY-MM-DD; ads running at some point from this date.
        active_to: YYYY-MM-DD; ads running at some point up to this date.
        match: 'any' (all words, default) or 'exact' (exact phrase).
        sort: 'relevance' (default), 'impressions' (most impressions first) or 'longevity'
            (longest-running first: days_active, applied to the returned page).
        min_days_active: Keep only ads running for at least this many days (applied to the
            returned page, so fewer ads may come back; same cost). Long-running ads are
            the ones that work ("winning ads"): each ad has days_active and a 0-100
            winning_score (longevity, variants, EU reach).
        limit: Ads per page, 1-30 (default 10).
        cursor: next_cursor from a previous call, to get the next page (same filters).
    

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "search_ads"
  }
}

Input Schema

NameRequiredDescriptionDefault
sortNorelevance
limitNo
matchNoany
queryNo
cursorNo
statusNoactive
ad_typeNoall
countryNoALL
page_idNo
active_toNo
languagesNo
platformsNo
media_typeNoall
active_fromNo
min_days_activeNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent annotations by disclosing the credit cost model (1 credit per call including empty results, errors free), the fact that limit does not affect cost, and that pagination consumes additional credits. It also warns that min_days_active and sort=longevity apply only to the returned page, which materially affects result expectations.

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?

Front-loads purpose and the cost model before the parameter list, which is the right ordering for an agent deciding whether to call. Slightly long, with minor redundancy on limit and cost being stated twice, but no sentence is filler.

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

Completeness5/5

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

For a 15-parameter search tool with an output schema, this covers everything an agent needs: scope, cost, pagination, per-parameter meaning, and even the meaning of key return fields (days_active, winning_score). Return format is correctly left to the output schema.

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?

With 0% schema description coverage, the description carries the full burden and documents all 15 parameters: date formats, ISO codes, enum meanings, and the counterintuitive 'any' = all words vs 'exact' = exact phrase. The only weakness is that a few defaults (limit, country) are restated from the schema rather than extended.

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?

States a specific verb and resource ('Search the public Meta Ad Library') and enumerates the platforms covered. An agent can distinguish it from siblings like get_ad and get_page_ads without opening any schema.

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?

Gives clear invocation conditions: query is 'Required unless page_id is given', and page_id points the agent to search_pages for lookup. Pagination guidance is explicit (next page = new call with cursor). It stops short of naming when to prefer get_ad or get_page_ads over this search.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.