Skip to main content
Glama

Search ads

ads_ads_search
Read-onlyIdempotent

Meta Ad Library API: Search ads. Ads matching a keyword or an advertiser page, with filters, up to 30 per call. Every ad carries days_active (whole days from started_at to ended_at, or to today while it runs; null when unknown) and winning_score (0-100, null when days_active is null): long-running ads are the ones that pay off. score = L + V + R, with L = 70 x min(days_active, 90) / 90, V = 15 x min(variants_count - 1, 9) / 9 and R = 15 x min(log10(1 + EU reach) / 6, 1). The EU reach is only in the single-ad lookup, so in lists score = (L + V) x 100 / 85: a missing reach never lowers it. Rounded to the nearest integer. min_days_active and sort=longevity apply to the ads of the returned page, at the same price. Price: 5 credits per call; failed calls are free. Paginated: pass pagination.next_cursor as cursor for the next page (each page is a new call). One of q, page_id is required.

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": "ads_ads_search"
  }
}

Input Schema

NameRequiredDescriptionDefault
qNoKeyword (required unless `page_id` is set)
sortNoOrder. `longevity` puts the longest-running ads of the page first.relevance
limitNoAds per page (max 30, one page of the source)
matchNoKeyword matchany
cursorNo`pagination.next_cursor` of the previous page
statusNoAd statusactive
ad_typeNoAll ads or political/issue adsall
countryNoTwo-letter country code or `ALL`ALL
page_idNoOnly ads of this advertiser page
active_toNoRunning on or before (YYYY-MM-DD)
languagesNoComma-separated ISO 639-1 codes
platformsNoComma-separated: facebook, instagram, messenger, audience_network
media_typeNoCreative typeall
active_fromNoRunning on or after (YYYY-MM-DD)
min_days_activeNoKeep only ads running for at least this many days (applied to the returned page, same price)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior5/5

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

With readOnly/idempotent/openWorld already declared by annotations, the description adds substantial non-redundant behavior: cost per call and free failures, page-by-page billing on pagination, and the semantics of the derived fields days_active and winning_score including the null conditions. It also discloses a subtle scoring asymmetry (list scores use (L+V) x 100/85 because EU reach is only available in the single-ad lookup). That is exactly the kind of context annotations cannot carry.

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-loaded with purpose, then cost, then pagination, then the constraint — a sensible order with little filler. The scoring formula (L/V/R components) is dense and arguably over-specified for a tool-selection description, though it does compensate for the absent output schema.

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 15-parameter, no-output-schema, billable search tool, the description covers cost, pagination, required-input constraint, and the two derived output fields. It does not describe the rest of the ad record returned (creative, spend, reach fields), which an agent cannot learn from any structured field here.

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?

Schema coverage is 100%, so the baseline is 3, but the description still adds meaning: it clarifies the q/page_id either-or requirement and explains that min_days_active and sort=longevity filter/order within the already-billed page rather than changing the query cost. Remaining parameters (country, platforms, media_type, match) are left entirely to the schema.

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 opening states a specific verb and resource ("Meta Ad Library API: Search ads") and narrows the scope to ads matching a keyword or an advertiser page, with a per-call cap. The trailing constraint "One of q, page_id is required" pins down the two entry modes. It stops short of explicitly contrasting with sibling lookups like ads_page_ads or ads_ad, so the boundary must be inferred.

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?

Useful operating guidance is present: pagination mechanics (pass pagination.next_cursor as cursor, each page is a new call), pricing (5 credits per call, failed calls free), and the note that min_days_active/sort=longevity apply within the returned page at the same price. What is missing is when to prefer this over sibling tools, e.g. whether to search here or use the single-ad or page-ads endpoints; usage is implied rather than stated.

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.