Search Meta Ad Library by Keyword
search_meta_ads_by_keywordUse 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. For UGC/creator-style or polished brand video ads, set style='ugc' or 'brand' (video only; 1 extra credit when new creatives get classified). For elections or political campaigns set ad_type='political_and_issue_ads' and country; for past periods add start_date/end_date (searches all statuses). get_playbook has written methods for hooks, scripts, angles and product research. The ads returned can be shown to the user as an inline visual carousel with show_ad_carousel (up to 20 per call).
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": {
"query": "<query>"
},
"name": "search_meta_ads_by_keyword"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| trim | No | True (default) returns trimmed ad fields. | |
| limit | No | Max ads to return (default 30 = 3 credits; 1 credit per 10 ads returned, at least 1; at most 10 pages). The response cursor fetches the next page. | |
| query | Yes | Keyword or phrase, e.g. "running shoes". | |
| style | No | Video creative style: "ugc" (a creator or customer filming themselves, handheld/selfie feel) or "brand" (polished brand-produced footage, motion graphics, product UI). Video ads only (implies media_type="video"). Inferred from each video's cover frame; ads whose frame shows too little are kept after the matches with style "unknown". Filters the ads fetched, so a wider limit gives it more to work with (up to 60 new creatives are classified per call). Costs 1 extra credit per call when any creative is newly classified; creatives classified before are free. | |
| cursor | No | Continuation token from a previous response. Present when more ads exist beyond what was scanned. | |
| status | No | "ALL", "ACTIVE" (default; "ALL" when start_date/end_date is set) or "INACTIVE". | |
| ad_type | No | "all" (default) or "political_and_issue_ads". | |
| context | No | One 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.' | |
| country | No | Two-letter country code. Default: all countries; set it when the user names a market. | |
| sort_by | No | "relevancy_monthly_grouped" (default, stays on-topic, ads from the last month only), "total_impressions" (largest advertisers first, looser matches, any age), "longest_running" or "newest" (these two rank only the ads fetched). | |
| end_date | No | Filter by impressions end date, YYYY-MM-DD. | |
| media_type | No | "all" (default), "image" (static creatives, including image carousels; a filtered scan: at least 2 credits) or "video" (video only). | |
| start_date | No | Filter by impressions start date, YYYY-MM-DD. | |
| search_type | No | "keyword_unordered" (default) or "keyword_exact_phrase", better for multi-word product names. | |
| conversation_id | No | The conversation_id this server returned earlier in this conversation, unchanged, including after later user messages. Omit it if you have none. Recorded for the server developer's analytics. | |
| min_duration_days | No | Only ads that have run for at least this many days, e.g. 90 for proven ads. A filtered scan: at least 2 credits. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| _mcp_instructions | No | Server-issued metadata for this conversation. |