Skip to main content
Glama

Manage Custom Audience (create / update / delete)

adsap_manage_custom_audience

Create, update, or delete a RULE-BASED custom audience: Website (pixel/site visitors), Engagement (Instagram/Facebook engagers), Lookalike (people similar to an existing audience), or App (mobile app users). Completes the pair with adsap_list_custom_audiences (read). For create, pick an audience_type and pass a rule (or lookalike fields). dry_run defaults TRUE: call once to preview, then again with dry_run:false to apply. Delete is PERMANENT and auto-pauses any ad sets using the audience — the dry_run preview lists them first. NOTE: this covers rule-based audiences only; uploading a customer list (hashed emails/phones) is NOT supported here. The account must accept Meta's Custom Audience Terms of Service once before any audience can be created (Meta returns an accept URL if not).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoRequired for action=create. The audience name shown in Ads Manager.
ruleNoRequired for create when audience_type is website/engagement/app (NOT lookalike). A JSON-ENCODED STRING (not an object). Structure: {"inclusions":{"operator":"or","rules":[<rule>]}} (optional top-level "exclusions" with the same shape). Each <rule>: {"event_sources":[{"type":"<TYPE>","id":"<ID>"}],"retention_seconds":<n>,"filter":{"operator":"and","filters":[...]},"template":"<TEMPLATE>"}. WEBSITE: type "pixel" (id from adsap_list_meta_assets pixels). All visitors → template "ALL_VISITORS" + filter {"field":"url","operator":"i_contains","value":""}. Specific pages → template "VISITORS_BY_URL" + filter {"field":"url","operator":"i_contains","value":"<keyword>"}. Standard events → template "VISITORS_BY_URL" + filter {"field":"event","operator":"eq","value":"Purchase"/"AddToCart"/"Lead"/...}. ENGAGEMENT (Instagram): type "ig_business" (id = Instagram account id from adsap_list_meta_assets), filter {"field":"event","operator":"=","value":"ig_business_profile_all"} (all engagers). APP: type "app" (app id), template "MACA_APP_LAUNCHED_USERS" + filter {"field":"event","operator":"=","value":"fb_mobile_activate_app"}. retention_seconds = how long to keep members (max 15552000 = 180 days; 2592000 = 30 days).
ratioNoLookalike only. Share of the population to match, 0.01 (1%, closest/smallest) to 0.20 (20%, broadest/largest). Defaults to 0.01.
actionYesWhat to do: "create" a new rule-based audience, "update" an existing one's name/description/rule, or "delete" one permanently.
dry_runNoTRUE (default) = preview only, nothing is written. For delete, the preview also lists which ad sets would be auto-paused. Set false to actually create/update/delete.
prefillNoOptional (website/engagement/app create). TRUE backfills the audience with historical data. Defaults to Meta's default (true).
descriptionNoOptional description for the audience (create or update).
ad_account_idYesact_<digits>. The ad account that owns (or will own) the custom audience. Used for ownership, workspace resolution, and Meta API budget.
audience_typeNoRequired for action=create. "website" = pixel/site visitors (WCA), "engagement" = people who engaged with your Instagram/Facebook (ECA), "lookalike" = people similar to an existing audience (LAL), "app" = mobile app users (MACA).
lookalike_countryNoLookalike only. ISO country code (e.g. "US", "FR", "GB"). DEPRECATED BY META (v26 / all versions from 2026-09-01): the API silently ignores it and creates a countryless parent lookalike — delivery locations come from the ad sets that use the audience. Still accepted for backward compatibility; Meta returns a deprecation warning.
custom_audience_idNoRequired for action=update and action=delete. The numeric id of the existing custom audience. Get it from adsap_list_custom_audiences.
origin_audience_idNoRequired for create when audience_type=lookalike. The numeric id of the SEED audience to model on (a WEBSITE/ENGAGEMENT/APP/CUSTOM audience — NOT another lookalike). Get it from adsap_list_custom_audiences.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden, and it excels: dry_run defaults to true and the two-call pattern is explicit, delete is described as PERMANENT with auto-pausing of ad sets and a preview listing them, and the lookalike_country deprecation (silently ignored) is disclosed. The TOS acceptance requirement adds an operational caveat. This is far beyond the minimum.

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?

The description is long, but justified by the tool's complexity (12 params, four audience types, a destructive delete path). It is front-loaded with the core action and types, then dry_run, then critical warnings, then exclusions. Each sentence provides distinct value, though it could be tightened slightly without losing content.

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 no annotations and no output schema, the description covers the essential operational context: required actions, dry_run semantics, destructive consequences, TOS prerequisite, and unsupported case. It does not describe the response/return format for create/update previews, but the lack of an output schema makes this a minor gap rather than a critical omission for a management tool.

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 baseline is 3. The main description adds general guidance (e.g., rule vs lookalike fields, dry_run behavior) but the detailed parameter semantics are already in the schema descriptions. It does not meaningfully extend beyond the schema for individual parameters, and the rule-construction details live in the schema, not the tool description.

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-resource pair: create, update, or delete rule-based custom audiences, and enumerates the four supported types (Website, Engagement, Lookalike, App). It clearly differentiates from the sibling adsap_list_custom_audiences by positioning this as the write counterpart and explicitly excludes customer-list uploads, leaving no ambiguity about scope.

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?

The description gives explicit when-to-use guidance: it names the read sibling for lookups, states what is NOT supported (hashed customer lists), and instructs on the dry_run workflow (preview first, then apply). It also flags the Meta TOS prerequisite and the deprecation of lookalike_country, helping the agent decide when and how to invoke the tool correctly.

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