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

TableJSON Schema
NameRequiredDescriptionDefault
trimNoTrue (default) returns trimmed ad fields.
limitNoMax ads to return (default 100, at most 10 pages).
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

TableJSON Schema
NameRequiredDescriptionDefault
_mcp_instructionsNoServer-issued metadata for this conversation.

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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."
  2. First observed

TDQS

A4.2/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 safety is covered. The description adds real behavioral context beyond them: the full-library cross-brand scope, the mandatory show_ad_carousel follow-up, the {ad_id, page_id} reference format, and cross-platform carousel mixing. It does not state auth/rate-limit behavior, but the mandatory downstream-call workflow is substantive disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

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

The purpose and alternative-routing are front-loaded and tight, which is good. However, roughly 70% of the text is a verbose, partially repetitive carousel-placement protocol ('REQUIRED', 'at least once this turn', 'Never render just 2-3 ads', 'strictly point → its carousel') that is more about show_ad_carousel than about this tool, bloating the definition.

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?

An output schema exists, so return values need not be explained, and the description covers purpose, alternatives, filters, the mandatory downstream rendering step, and the zero-results edge case. It is complete enough for correct invocation; only auth/permission or pagination-context notes are absent.

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 all 14 parameters (query, country, status, media_type, date range, sort_by, search_type, etc.) are already documented in the schema. The description only restates the existence of 'optional country, status, media type, and date filters' and adds no syntax, defaults, or interaction rules beyond what the schema provides, so baseline 3 is correct.

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 opening sentence gives a specific verb and resource (discover ads by keyword/topic, full Meta Ad Library) and explicitly distinguishes itself from a sibling by contrasting with get_meta_ads, which 'only returns ads from the brand's own page.' It also names a second use case (partnership/influencer ads via creators), so an agent can select it 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?

It states exactly when to use this tool ('without knowing a specific brand', influencer/partnership discovery) and names the alternative (get_meta_ads) plus the condition that separates them. It also gives explicit when-to-skip guidance for the downstream carousel call (zero ads returned), leaving nothing 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