Skip to main content
Glama

facebook_ad_library_search

Search Meta Ad Library by keyword — active/inactive, media type, date range, platforms, cursor, and spend/impressions when Meta publishes them. Costs 2 credits. Empty results and failures are never charged. Pass cache=true for a free 24h cache hit (default always fresh).

Input Schema

NameRequiredDescriptionDefault
qYesKeyword, brand, or advertiser to search Meta Ad Library (min 2 characters).
trimNoWhen true, omit cards/images/videos typed arrays (media[] stays). Captapi payloads are already lean vs Meta nested snapshots.
cacheNoSet true to serve from the 24h response cache (0 credits on hit). Default false — always fetch fresh.
limitNoMax items to return (default 20, max 200). Flat 2 credits per call.
cursorNoPagination cursor from a previous nextCursor. Pages through the current Meta HTML result batch.
statusNoAd delivery status: ACTIVE (default), INACTIVE, or ALL. Use ACTIVE for "what are they running now?".
ad_typeNoall (default) or political_and_issue_ads. Spend/impressions are typically only filled for political/issue ads.
countryNoTwo-letter ISO country code (e.g. US, GB, DE). Default US. Non-ISO codes are a definitive 400 INVALID_COUNTRY — Meta would otherwise ignore the code and search globally while echoing it back as if the filter worked.
sort_byNoMeta sort mode: total_impressions or relevancy_monthly_grouped.
end_dateNoOnly ads shown (delivered) on or before this date (YYYY-MM-DD).
platformsNoComma-separated publisher platforms to keep: FACEBOOK, INSTAGRAM, MESSENGER, AUDIENCE_NETWORK, THREADS.
media_typeNoCreative filter: ALL (default), IMAGE, VIDEO, MEME, IMAGE_AND_MEME, or NONE.
start_dateNoOnly ads shown (delivered) on or after this date (YYYY-MM-DD). Delivery-date window, not a start-date filter: an ad that started earlier but was still running in the range is included.
search_typeNokeyword_unordered (default) or keyword_exact_phrase.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / end_date / description
      Previous value: -"Only ads with delivery start on/before this date (YYYY-MM-DD)."New value: +"Only ads shown (delivered) on or before this date (YYYY-MM-DD)."
    • changedInput schema / properties / start_date / description
      Previous value: -"Only ads with delivery start on/after this date (YYYY-MM-DD)."New value: +"Only ads shown (delivered) on or after this date (YYYY-MM-DD). Delivery-date window, not a start-date filter: an ad that started earlier but was still running in the range is included."
  2. Changed1 schema field changed
    • changedInput schema / properties / country / description
      Previous value: -"Two-letter ISO country code (e.g. US, GB, DE). Default US."New value: +"Two-letter ISO country code (e.g. US, GB, DE). Default US. Non-ISO codes are a definitive 400 INVALID_COUNTRY — Meta would otherwise ignore the code and search globally while echoing it back as if the filter worked."
  3. Changed1 schema field changed
    • changedInput schema / properties / cache / description
      Previous value: -"Set true to serve from the 24h response cache (0 credits on hit). Default false — always fetch fresh. Envelope includes cached + cachedAt on hits."New value: +"Set true to serve from the 24h response cache (0 credits on hit). Default false — always fetch fresh."
  4. Changed13 schema fields changed
    • changedInput schema / properties / ad_type / description
      Previous value: -"all (default) or political_and_issue_ads."New value: +"all (default) or political_and_issue_ads. Spend/impressions are typically only filled for political/issue ads."
    • changedInput schema / properties / cache / description
      Previous value: -"Set true to serve from the 24h response cache. Default false — always fetch fresh data."New value: +"Set true to serve from the 24h response cache (0 credits on hit). Default false — always fetch fresh. Envelope includes cached + cachedAt on hits."
    • changedInput schema / properties / country / description
      Previous value: -"ISO country code. Default US."New value: +"Two-letter ISO country code (e.g. US, GB, DE). Default US."
    • addedInput schema / properties / cursor
      Added value: +{
      +  "description": "Pagination cursor from a previous nextCursor. Pages through the current Meta HTML result batch.",
      +  "type": "string"
      +}
    • changedInput schema / properties / end_date / description
      Previous value: -"Delivery start on/before YYYY-MM-DD."New value: +"Only ads with delivery start on/before this date (YYYY-MM-DD)."
    • changedInput schema / properties / limit / description
      Previous value: -"Max items to return. Default 20, max 200. Billed per result."New value: +"Max items to return (default 20, max 200). Flat 2 credits per call."
    • changedInput schema / properties / media_type / description
      Previous value: -"ALL (default), IMAGE, VIDEO, MEME, IMAGE_AND_MEME, or NONE."New value: +"Creative filter: ALL (default), IMAGE, VIDEO, MEME, IMAGE_AND_MEME, or NONE."
    • addedInput schema / properties / platforms
      Added value: +{
      +  "description": "Comma-separated publisher platforms to keep: FACEBOOK, INSTAGRAM, MESSENGER, AUDIENCE_NETWORK, THREADS.",
      +  "type": "string"
      +}
    • changedInput schema / properties / q / description
      Previous value: -"Search query or keywords (min 2 chars)."New value: +"Keyword, brand, or advertiser to search Meta Ad Library (min 2 characters)."
    • changedInput schema / properties / sort_by / description
      Previous value: -"total_impressions or relevancy_monthly_grouped."New value: +"Meta sort mode: total_impressions or relevancy_monthly_grouped."
    • changedInput schema / properties / start_date / description
      Previous value: -"Delivery start on/after YYYY-MM-DD."New value: +"Only ads with delivery start on/after this date (YYYY-MM-DD)."
    • changedInput schema / properties / status / description
      Previous value: -"ACTIVE (default), INACTIVE, or ALL."New value: +"Ad delivery status: ACTIVE (default), INACTIVE, or ALL. Use ACTIVE for \"what are they running now?\"."
    • addedInput schema / properties / trim
      Added value: +{
      +  "description": "When true, omit cards/images/videos typed arrays (media[] stays). Captapi payloads are already lean vs Meta nested snapshots.",
      +  "type": "boolean"
      +}
  5. Changed7 schema fields changed
    • addedInput schema / properties / ad_type
      Added value: +{
      +  "description": "all (default) or political_and_issue_ads.",
      +  "type": "string"
      +}
    • addedInput schema / properties / end_date
      Added value: +{
      +  "description": "Delivery start on/before YYYY-MM-DD.",
      +  "type": "string"
      +}
    • addedInput schema / properties / media_type
      Added value: +{
      +  "description": "ALL (default), IMAGE, VIDEO, MEME, IMAGE_AND_MEME, or NONE.",
      +  "type": "string"
      +}
    • addedInput schema / properties / search_type
      Added value: +{
      +  "description": "keyword_unordered (default) or keyword_exact_phrase.",
      +  "type": "string"
      +}
    • addedInput schema / properties / sort_by
      Added value: +{
      +  "description": "total_impressions or relevancy_monthly_grouped.",
      +  "type": "string"
      +}
    • addedInput schema / properties / start_date
      Added value: +{
      +  "description": "Delivery start on/after YYYY-MM-DD.",
      +  "type": "string"
      +}
    • addedInput schema / properties / status
      Added value: +{
      +  "description": "ACTIVE (default), INACTIVE, or ALL.",
      +  "type": "string"
      +}
  6. Changed1 schema field changed
    • changedInput schema / properties / cache / description
      Previous value: -"Responses are cached for 24 hours by default. Set false to bypass the cache and always fetch fresh data (default true)."New value: +"Set true to serve from the 24h response cache. Default false — always fetch fresh data."
  7. Changed1 schema field changed
    • addedInput schema / properties / cache
      Added value: +{
      +  "description": "Responses are cached for 24 hours by default. Set false to bypass the cache and always fetch fresh data (default true).",
      +  "type": "boolean"
      +}
  8. Added

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden and does real work: it discloses the 2-credit cost, the no-charge-on-empty-or-failure policy, the 24h cache semantics and that the default bypasses cache, and that spend/impressions are only sometimes published. Not covered are auth requirements, rate limits, or error taxonomy beyond the free-failure rule.

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 front-loaded sentences: the operation and its filter surface first, then the cost/cache economics. Every clause carries information — no restatement of the title, no filler.

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 14-parameter tool with no annotations and no output schema, the description covers cost, caching, filter breadth and the data-availability caveat well. It stops short of telling the agent what a result record looks like or how nextCursor is returned, which is the main residual gap given the absent output 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%, so the schema already explains q, cursor, status, country, dates, platforms, media_type and trim. The description restates the same dimension list and adds only a small increment ("spend/impressions when Meta publishes them", the cache default), so the baseline 3 applies.

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?

States a specific verb and resource ("Search Meta Ad Library by keyword") and enumerates the filter surface, so an agent immediately knows this is the keyword-search entry point for Meta ads. It does not name the closely related siblings (facebook_ad_library_company_ads, facebook_ad_library_search_companies) to disambiguate, which is the only thing keeping it from a 5.

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 guidance exists but is narrow: it tells you to pass cache=true for a free 24h hit and that defaults are always fresh, plus implicit economics (2 credits, free on empty/failure). There is no statement of when to prefer this over company_ads or ad_details lookups, so routing must be inferred from the tool name and the word "keyword".

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.