get_adset_details
Retrieve comprehensive ad set details including targeting, optimization, learning stage, frequency caps, and attribution settings using an ad set ID.
Instructions
Get detailed ad set information including targeting, optimization, learning stage, frequency caps, and attribution settings.
Args: adset_id: Ad set ID (numeric string).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| adset_id | Yes |
Implementation Reference
- meta_ads_mcp/core/adsets.py:156-194 (handler)The main handler function for the 'get_adset_details' tool. Fetches detailed ad set info from Meta's Graph API including targeting, optimization, budget, learning stage, frequency caps, and attribution settings.
@mcp.tool() def get_adset_details(adset_id: str) -> dict: """ Get detailed ad set information including targeting, optimization, learning stage, frequency caps, and attribution settings. Args: adset_id: Ad set ID (numeric string). """ api_client._ensure_initialized() try: result = api_client.graph_get( f"/{adset_id}", fields=ADSET_DETAIL_FIELDS, ) # Enrich budget display if result.get("daily_budget"): result["daily_budget_display"] = format_budget_cents_to_currency(result["daily_budget"]) if result.get("lifetime_budget"): result["lifetime_budget_display"] = format_budget_cents_to_currency(result["lifetime_budget"]) # Get child ad count try: ads_result = api_client.graph_get( f"/{adset_id}/ads", fields=["id"], params={"limit": "0"}, ) result["ad_count"] = len(ads_result.get("data", [])) except MetaAPIError: result["ad_count"] = None result["rate_limit_usage_pct"] = api_client.rate_limits.max_usage_pct return result except MetaAPIError: raise - meta_ads_mcp/core/adsets.py:60-67 (schema)Schema definition for the detail fields requested from the Meta API when retrieving ad set details.
ADSET_DETAIL_FIELDS = ADSET_LIST_FIELDS + [ "targeting", "promoted_object", "budget_remaining", "bid_amount", "frequency_control_specs", "pacing_type", "destination_type", "attribution_spec", "learning_stage_info", "issues_info", ] - meta_ads_mcp/core/adsets.py:156-157 (registration)Registration of 'get_adset_details' as an MCP tool via the @mcp.tool() decorator.
@mcp.tool() def get_adset_details(adset_id: str) -> dict: - meta_ads_mcp/core/utils.py:23-26 (helper)Helper utility used by get_adset_details to format budget values (cents) into human-readable currency strings.
def format_budget_cents_to_currency(cents: int | str, currency: str = "EUR") -> str: """Convert Meta API budget (in cents) to human-readable currency string.""" value = int(cents) / 100 return f"{currency} {value:.2f}"