Skip to main content
Glama

Search ads in the Meta Ad Library

meta_ads_search
Read-onlyIdempotent

Search ads running on Facebook, Instagram and Meta’s other apps by keyword or advertiser, with filters for country, active status, ad category, media type, platform, language and dates. Each ad includes its text, images, videos, carousel cards, link, call to action, run dates, platforms and advertiser, plus spend, impressions and the paid-for-by disclaimer for ads about social issues, elections or politics. Read-only: returns public data and changes nothing. Costs 1 credit per result returned, with a minimum of 1 credit per request.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "exactPhrase": "<exactPhrase>",
      "country": "<country>",
      "activeStatus": "<activeStatus>",
      "adType": "<adType>",
      "mediaType": "<mediaType>",
      "sortBy": "<sortBy>",
      "count": "<count>"
    },
    "name": "meta_ads_search"
  }
}

Input Schema

NameRequiredDescriptionDefault
qNoKeywords to search the ads’ text for, e.g. "running shoes". Leave it out to list every ad matching the other filters.
countYesNumber of results to return (1–30). Defaults to 10.
adTypeYesAd category: "all", "political_and_issue_ads" (social issues, elections or politics), "housing_ads", "employment_ads" or "credit_ads". Defaults to "all".all
cursorNoThe previous response's `nextCursor`, to fetch the next page. Omit it for the first page.
pageIdNoOnly return ads from this advertiser: its Facebook Page ID, e.g. "15087023444", as returned in `page.id` or by the advertiser search. The Ad Library link of the advertiser’s ads (`?view_all_page_id=<id>`) works too.
sortByYesOrder of the ads: most seen first ("impressions"), or recently started ads first ("recent"), which Meta orders roughly rather than strictly by start date. Defaults to "impressions".impressions
countryYesTwo-letter country code to search ads shown in, e.g. "US" or "GB", or "ALL" for every country. Defaults to "ALL".ALL
endDateNoOnly return ads that ran on or before this date (YYYY-MM-DD), e.g. "2026-03-31".
cacheOnlyNoReturn only a cached result and never scrape live. With `cacheMaxAgeHours`, only a result that recent is returned; without it, the latest cached result of any age. Responds 404, at no cost, when there is none, e.g. true.
languagesNoOnly return ads in these languages, as two-letter codes, e.g. ["en", "es"].
mediaTypeYesMedia in the ad: "all", "image", "meme", "image_and_meme", "video", or "none" for ads with no image or video. Defaults to "all".all
platformsNoOnly return ads running on these platforms, e.g. ["instagram"]. Leave it out for every platform.
startDateNoOnly return ads that ran on or after this date (YYYY-MM-DD), e.g. "2026-01-01".
exactPhraseYesMatch `q` as an exact phrase instead of matching any ad that has all its words. Defaults to false.
activeStatusYesReturn ads that are still running ("active"), that stopped ("inactive"), or both ("all"). Defaults to "active".active
cacheMaxAgeHoursNoAccept a cached result scraped up to this many hours ago. A cached result costs no credits, and its `cachedAt` says when it was scraped. When no cached result is that recent, the data is scraped live at the normal price. Leave it out to always scrape live, e.g. 24.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, openWorldHint and destructiveHint=false, and the description reinforces rather than contradicts them ('returns public data and changes nothing'). It adds genuinely new behavior beyond annotations: a billing model ('1 credit per result returned, with a minimum of 1 credit per request') that materially affects how an agent should size the `count` parameter. It stops short of covering pagination or the cached-result cost path, which live only in the schema.

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?

Three sentences ordered purpose, output, then cost/safety, with the most decision-relevant information up front. The long return-field enumeration in sentence two is justified because there is no output schema, and no sentence is redundant.

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 16-parameter search tool with no output schema, the description does the right extra work: it enumerates returned fields (including spend, impressions and paid-for-by disclaimers) and discloses the credit cost. The main gaps are pagination via `cursor`/`nextCursor` and the zero-cost cached path, both of which are only discoverable by reading the schema.

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?

Schema description coverage is 100%, with enums and examples on every meaningful field, so the schema carries the parameter burden. The description only echoes the filter families (country, active status, ad category, media type, platform, language, dates) without adding format or interaction semantics such as how `exactPhrase` modifies `q`. Baseline 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 opening sentence gives a specific verb ('Search ads'), the exact resource ('ads running on Facebook, Instagram and Meta's other apps'), and the two primary access paths (keyword or advertiser). It does not explicitly contrast itself with siblings like meta_ads_get_ad_details or meta_ads_search_companies, so an agent must infer the boundary from the name alone.

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?

Usage is only implied: the description says search works 'by keyword or advertiser', which hints at when this tool is the entry point, but there is no explicit when-to-use/when-not statement and no named alternative for the detail-fetch case. The credit-cost sentence is useful for deciding whether to call, but that is cost guidance rather than selection guidance.

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.

Resources