Skip to main content
Glama

Search Meta Ad Library by Keyword

search_meta_ads_by_keyword
Read-only

Use this when you want to discover ads by keyword or topic without knowing a specific brand, OR to find partnership/influencer ads a brand is running via creators (get_meta_ads only returns ads from the brand's own page). Searches the full Meta Ad Library with optional country, status, media type, and date filters. SHOWING THE ADS — REQUIRED: don't just summarise in text — you MUST call show_ad_carousel at least once this turn so the user SEES the creatives as visual proof, not only reads about them. Interleave it WITH your analysis: each time you make a point about specific ads, call show_ad_carousel right after that sentence with only the ads that evidence THAT point (pass each as {ad_id, page_id} copied from this tool's output; the server fills in copy/media/cards). Make as many carousels as you have distinct points, strictly point → its carousel → next point → its carousel; NEVER stack carousels back-to-back or dump all points as a list after the carousels. Be generous: across your carousels, show MOST of the ads this tool returned (up to 20 per carousel) — skip only ads that are irrelevant or near-duplicates. Never render just 2-3 ads when a dozen were found; if discussed points don't cover all the ads, close with a broader carousel of the rest. Don't finish a turn that discusses specific ads without having rendered at least one. You may mix Meta {ad_id, page_id}, Google {ad_url}, LinkedIn {linkedin_id}, and TikTok {tiktok_id} refs in a single carousel when a point spans platforms. The only time to skip it entirely is when this tool returned zero ads.

Input Schema

NameRequiredDescriptionDefault
trimNoTrue (default) returns trimmed ad fields.
limitNoMax ads to return (default 30 = one page at 1 credit; at most 10 pages). The response cursor fetches the next page.
queryYesKeyword or phrase, e.g. "running shoes".
cursorNoContinuation token from a previous response. Present when more ads exist beyond what was scanned.
statusNo"ALL", "ACTIVE" (default) or "INACTIVE".
ad_typeNo"all" (default) or "political_and_issue_ads".
contextNoOne plain sentence, 8-20 words, starting with a verb, stating what the user is trying to accomplish in this conversation. Name the brand, competitor, industry, or topic involved. Reuse the exact same sentence on every tool call in this conversation. Never include people's names, emails, phone numbers, credentials, or internal company details. Never describe this tool or why it was chosen. Example: 'Compare Notion and Coda Meta ads to find hooks for a productivity app launch.'
countryNoTwo-letter country code. Default: all countries; set it when the user names a market.
sort_byNo"relevancy_monthly_grouped" (default, stays on-topic) or "total_impressions" (largest advertisers first, looser matches).
end_dateNoFilter by impressions end date, YYYY-MM-DD.
media_typeNo"all" (default), "image" (static creatives, including image carousels) or "video" (video only).
start_dateNoFilter by impressions start date, YYYY-MM-DD.
search_typeNo"keyword_unordered" (default) or "keyword_exact_phrase", better for multi-word product names.
conversation_idNoEcho the conversation_id from the server's previous response. The server provides it on the first call — never invent one, and do not issue parallel tool calls until you have it.

Output Schema

NameRequiredDescriptionDefault
_mcp_instructionsNoServer-issued metadata for this conversation.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / limit / default
      Previous value: -100New value: +30
    • changedInput schema / properties / limit / description
      Previous value: -"Max ads to return (default 100, at most 10 pages)."New value: +"Max ads to return (default 30 = one page at 1 credit; at most 10 pages). The response cursor fetches the next page."
  2. Changed12 schema fields changed
    • addedInput schema / properties / ad_type / description
      Added value: +"\"all\" (default) or \"political_and_issue_ads\"."
    • addedInput schema / properties / country / description
      Added value: +"Two-letter country code. Default: all countries; set it when the user names a market."
    • addedInput schema / properties / cursor / description
      Added value: +"Continuation token from a previous response. Present when more ads exist beyond what was scanned."
    • addedInput schema / properties / end_date / description
      Added value: +"Filter by impressions end date, YYYY-MM-DD."
    • addedInput schema / properties / limit / description
      Added value: +"Max ads to return (default 100, at most 10 pages)."
    • addedInput schema / properties / media_type / description
      Added value: +"\"all\" (default), \"image\" (static creatives, including image carousels) or \"video\" (video only)."
    • addedInput schema / properties / query / description
      Added value: +"Keyword or phrase, e.g. \"running shoes\"."
    • addedInput schema / properties / search_type / description
      Added value: +"\"keyword_unordered\" (default) or \"keyword_exact_phrase\", better for multi-word product names."
    • addedInput schema / properties / sort_by / description
      Added value: +"\"relevancy_monthly_grouped\" (default, stays on-topic) or \"total_impressions\" (largest advertisers first, looser matches)."
    • addedInput schema / properties / start_date / description
      Added value: +"Filter by impressions start date, YYYY-MM-DD."
    • addedInput schema / properties / status / description
      Added value: +"\"ALL\", \"ACTIVE\" (default) or \"INACTIVE\"."
    • addedInput schema / properties / trim / description
      Added value: +"True (default) returns trimmed ad fields."
  3. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already establish read-only, open-world, non-destructive behavior. The description adds important behavioral guidance beyond annotations, including the required show_ad_carousel workflow and the distinction from get_meta_ads. It does not mention credit consumption or pagination behavior, but those are covered by 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.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded, but the description is dominated by a long, repetitive set of carousel-rendering instructions. Several sentences restate the requirement to call show_ad_carousel, making it bloated for a search tool whose parameter semantics are already handled by the 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?

Given the rich schema and output schema, the description covers the key purpose, alternative tool, and required post-processing workflow. It is complete enough to invoke correctly, though it spends disproportionate space on carousel behavior rather than search behavior.

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 documents all 14 parameters in detail. The description only broadly mentions optional country, status, media type, and date filters, adding little semantic meaning beyond the schema.

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 states a specific verb and resource: 'discover ads by keyword or topic' and 'Searches the full Meta Ad Library'. It explicitly distinguishes this from get_meta_ads by noting that get_meta_ads only returns ads from the brand's own page.

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?

It gives clear when-to-use conditions: when you do not know a specific brand, or when you want partnership/influencer ads via creators. It names the alternative tool and the condition that selects it, leaving little 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.

Resources