Skip to main content
Glama

Facebook: Ads

facebook_ads
Read-only

Meta Ads Library: search ads, find advertisers by keyword, advertiser page details, single ad details and supported countries.

Actions:

  • action=search: Search ads in the Meta Ad Library. Pass a keyword (query) to find ads about a topic, or ad_page_id to list one advertiser's ads; filter by country, active status and date range, sort by impressions or recency. Returns ads with creative, body text, dates, platforms and snapshot URL, plus an end_cursor. Get an advertiser's ad_page_id from action=keywords or facebook_page (action=details). Pricing: 1 credit per call. Inputs: query (optional), ad_page_id (optional), country (optional), activeStatus (optional), after_time (optional), before_time (optional), sort_data (optional), end_cursor (optional).

  • action=keywords: Find advertisers running ads that match a keyword: returns Facebook pages with their page_id and ad count. Use it to discover who advertises on a topic, then pass a page_id to action=search (as ad_page_id) or action=page_details. To get the ads for a keyword directly, use action=search. Pricing: 1 credit per call. Inputs: query (required), country (optional).

  • action=page_details: Get an advertiser's Ads Library profile: page name, verification status, category, location and total ad count. Needs the page ID (ad_page_id from facebook_page (action=details) or page_id from action=keywords). To list the ads themselves, use action=search with ad_page_id. Pricing: 1 credit per call. Inputs: page_id (required).

  • action=archive_details: Get one Ad Library ad in full: creative, body text, CTA, platforms, countries, date range, and spend and impression estimates where Meta publishes them. Needs the ad_archive_id from a action=search result. Pricing: 1 credit per call. Inputs: ad_archive_id (required), page_id (optional), country (optional), is_ad_non_political (optional), is_ad_not_aaa_eligible (optional).

  • action=countries: List the country codes the Ads Library tools accept in their country parameter. Pricing: 1 credit per call. Inputs: none.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoKeyword. search: words in the ads (or pass ad_page_id instead) · keywords: a topic to find advertisers for, e.g. running shoes. Required for: keywords. Optional for: search.
actionYesWhich operation to run. See the tool description for what each action returns and which parameters it needs.
countryNoISO country code or "ALL". Optional for: search, keywords, archive_details.
page_idNoAdvertiser page ID: ad_page_id from facebook_page (action=details), or page_id from action=keywords. Required for: page_details. Optional for: archive_details.
sort_dataNoSort by "impressions" or "recent". Optional for: search.
ad_page_idNoFacebook AD Page ID (alternative to query). Optional for: search.
after_timeNoFilter ads after this date (YYYY-MM-DD). Optional for: search.
end_cursorNoPagination cursor. Optional for: search.
before_timeNoFilter ads before this date (YYYY-MM-DD). Optional for: search.
activeStatusNoFilter: ALL, Active, or Inactive. Optional for: search.
ad_archive_idNoAd Library archive ID of the ad (ad_archive_id from a action=search result). Required for: archive_details.
is_ad_non_politicalNoFilter non-political ads. Optional for: archive_details.
is_ad_not_aaa_eligibleNoFilter AAA eligibility. Optional for: archive_details.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYesJSON response from the SocialAPIs REST endpoint, unchanged. Object or array depending on the endpoint; most include a `meta` block (statusCode, duration, creditsCharged, creditsRemaining).
creditsChargedNoCredits charged for this call, or null if the endpoint did not report it.
creditsRemainingNoCredits left on the API key after this call, or null if not reported.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed12 schema fields changed
    • changedInput schema / properties / activeStatus / description
      Previous value: -"search (optional): Filter: ALL, Active, or Inactive."New value: +"Filter: ALL, Active, or Inactive.\nOptional for: search."
    • changedInput schema / properties / ad_archive_id / description
      Previous value: -"archive_details (required): Ad Library archive ID of the ad (ad_archive_id from a action=search result)."New value: +"Ad Library archive ID of the ad (ad_archive_id from a action=search result).\nRequired for: archive_details."
    • changedInput schema / properties / ad_page_id / description
      Previous value: -"search (optional): Facebook AD Page ID (alternative to query)."New value: +"Facebook AD Page ID (alternative to query).\nOptional for: search."
    • changedInput schema / properties / after_time / description
      Previous value: -"search (optional): Filter ads after this date (YYYY-MM-DD)."New value: +"Filter ads after this date (YYYY-MM-DD).\nOptional for: search."
    • changedInput schema / properties / before_time / description
      Previous value: -"search (optional): Filter ads before this date (YYYY-MM-DD)."New value: +"Filter ads before this date (YYYY-MM-DD).\nOptional for: search."
    • changedInput schema / properties / country / description
      Previous value: -"search, keywords, archive_details (optional): ISO country code or \"ALL\"."New value: +"ISO country code or \"ALL\".\nOptional for: search, keywords, archive_details."
    • changedInput schema / properties / end_cursor / description
      Previous value: -"search (optional): Pagination cursor."New value: +"Pagination cursor.\nOptional for: search."
    • changedInput schema / properties / is_ad_non_political / description
      Previous value: -"archive_details (optional): Filter non-political ads."New value: +"Filter non-political ads.\nOptional for: archive_details."
    • changedInput schema / properties / is_ad_not_aaa_eligible / description
      Previous value: -"archive_details (optional): Filter AAA eligibility."New value: +"Filter AAA eligibility.\nOptional for: archive_details."
    • changedInput schema / properties / page_id / description
      Previous value: -"page_details (required): Advertiser page ID: ad_page_id from facebook_page (action=details), or page_id from action=keywords. archive_details (optional): Facebook Page ID."New value: +"Advertiser page ID: ad_page_id from facebook_page (action=details), or page_id from action=keywords.\nRequired for: page_details. Optional for: archive_details."
    • changedInput schema / properties / query / description
      Previous value: -"search (optional): Search keyword for ads. keywords (required): Keyword to find advertisers for, e.g. running shoes."New value: +"Keyword. search: words in the ads (or pass ad_page_id instead) · keywords: a topic to find advertisers for, e.g. running shoes.\nRequired for: keywords. Optional for: search."
    • changedInput schema / properties / sort_data / description
      Previous value: -"search (optional): Sort by \"impressions\" or \"recent\"."New value: +"Sort by \"impressions\" or \"recent\".\nOptional for: search."
  2. Changed12 schema fields changed
    • changedInput schema / properties / activeStatus / description
      Previous value: -"For search: Filter: ALL, Active, or Inactive."New value: +"search (optional): Filter: ALL, Active, or Inactive."
    • changedInput schema / properties / ad_archive_id / description
      Previous value: -"For archive_details: Ad Library archive ID of the ad (ad_archive_id from a action=search result)."New value: +"archive_details (required): Ad Library archive ID of the ad (ad_archive_id from a action=search result)."
    • changedInput schema / properties / ad_page_id / description
      Previous value: -"For search: Facebook AD Page ID (alternative to query)."New value: +"search (optional): Facebook AD Page ID (alternative to query)."
    • changedInput schema / properties / after_time / description
      Previous value: -"For search: Filter ads after this date (YYYY-MM-DD)."New value: +"search (optional): Filter ads after this date (YYYY-MM-DD)."
    • changedInput schema / properties / before_time / description
      Previous value: -"For search: Filter ads before this date (YYYY-MM-DD)."New value: +"search (optional): Filter ads before this date (YYYY-MM-DD)."
    • changedInput schema / properties / country / description
      Previous value: -"For search, keywords, archive_details: ISO country code or \"ALL\"."New value: +"search, keywords, archive_details (optional): ISO country code or \"ALL\"."
    • changedInput schema / properties / end_cursor / description
      Previous value: -"For search: Pagination cursor."New value: +"search (optional): Pagination cursor."
    • changedInput schema / properties / is_ad_non_political / description
      Previous value: -"For archive_details: Filter non-political ads."New value: +"archive_details (optional): Filter non-political ads."
    • changedInput schema / properties / is_ad_not_aaa_eligible / description
      Previous value: -"For archive_details: Filter AAA eligibility."New value: +"archive_details (optional): Filter AAA eligibility."
    • changedInput schema / properties / page_id / description
      Previous value: -"For page_details: Advertiser page ID: ad_page_id from facebook_page (action=details), or page_id from action=keywords. For archive_details: Facebook Page ID."New value: +"page_details (required): Advertiser page ID: ad_page_id from facebook_page (action=details), or page_id from action=keywords. archive_details (optional): Facebook Page ID."
    • changedInput schema / properties / query / description
      Previous value: -"For search: Search keyword for ads. For keywords: Keyword to find advertisers for, e.g. running shoes."New value: +"search (optional): Search keyword for ads. keywords (required): Keyword to find advertisers for, e.g. running shoes."
    • changedInput schema / properties / sort_data / description
      Previous value: -"For search: Sort by \"impressions\" or \"recent\"."New value: +"search (optional): Sort by \"impressions\" or \"recent\"."
  3. Added

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false and openWorldHint=true, so the safety profile is covered. The description adds real behavioral context beyond that: a cost model ('Pricing: 1 credit per call') on every action, the presence of an end_cursor for pagination on search, and the caveat that spend/impression estimates are only returned 'where Meta publishes them'. It does not discuss rate limits or auth, but the annotations carry the safety burden.

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?

Well front-loaded with the overall scope, then cleanly organized as one bullet per action with a consistent 'Pricing/Inputs' footer, which makes scanning easy. It loses a point for redundancy: the identical 'Pricing: 1 credit per call' line is repeated five times, and the 'Inputs:' lines duplicate what the 100%-covered schema already states.

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 13-parameter, 5-action multiplexed tool, the description covers every action, its inputs, its return shape in brief, its cost, and the cross-tool workflow to obtain each required ID. An output schema exists, so return-value detail is correctly left out, and nothing an agent needs to invoke a given action successfully is missing.

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%, and the schema already marks each parameter with 'Required for: X / Optional for: Y', so the description's per-action 'Inputs:' lines largely restate structured data. It does add a small amount of meaning (ad_page_id described as 'an alternative to query', and derivation of ad_archive_id from search results), but the baseline of 3 is appropriate when the schema does the heavy lifting.

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 names the resource (Meta Ads Library) and enumerates five distinct actions with a specific verb+output for each: search ads, find advertisers, advertiser page details, single ad details, supported countries. It also disambiguates from siblings by naming facebook_page (action=details) as the source of ad_page_id. An agent can tell exactly what each action does without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit routing is given for every fork: action=keywords to discover advertisers then feed the page_id into action=search or action=page_details, and conversely 'To get the ads for a keyword directly, use action=search' rather than keywords. Prerequisites are stated per action (archive_details 'Needs the ad_archive_id from a action=search result'). Nothing is left to inference.

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.