Skip to content

Meta Ads (Facebook/Instagram) MCP server for Claude, ChatGPT, Perplexity & Cursor — the Meta node of Pipeboard’s 5-platform family (+ Google, TikTok, Snap, Reddit). Hosted remote MCP, badged Meta Business Partner, free plan — no self-hosting required.

Refactor update_ad and get_adset_details functions for improved parameter handling and debugging

Yves Junqueirad4fabd19600e
diff --git a/meta_ads_mcp/core/ads.py b/meta_ads_mcp/core/ads.py
index 4fc87c3..71ccff1 100644
--- a/meta_ads_mcp/core/ads.py
+++ b/meta_ads_mcp/core/ads.py
@@ -323,7 +323,7 @@ async def update_ad(
ad_id: str,
status: str = None,
bid_amount: int = None,
- tracking_specs: Optional[List[Dict[str, Any]]] = None,
+ tracking_specs = None,
access_token: str = None
) -> str:
"""
diff --git a/meta_ads_mcp/core/adsets.py b/meta_ads_mcp/core/adsets.py
index c5e93c7..1b9850d 100644
--- a/meta_ads_mcp/core/adsets.py
+++ b/meta_ads_mcp/core/adsets.py
@@ -74,12 +74,19 @@ async def get_adset_details(access_token: str = None, adset_id: str = None) -> s
return json.dumps({"error": "No ad set ID provided"}, indent=2)
endpoint = f"{adset_id}"
+ # Explicitly prioritize frequency_control_specs in the fields request
params = {
- "fields": "id,name,campaign_id,status,daily_budget,lifetime_budget,targeting,bid_amount,bid_strategy,optimization_goal,billing_event,start_time,end_time,created_time,updated_time,attribution_spec,destination_type,promoted_object,pacing_type,budget_remaining,frequency_control_specs{event,interval_days,max_frequency}"
+ "fields": "id,name,campaign_id,status,frequency_control_specs{event,interval_days,max_frequency},daily_budget,lifetime_budget,targeting,bid_amount,bid_strategy,optimization_goal,billing_event,start_time,end_time,created_time,updated_time,attribution_spec,destination_type,promoted_object,pacing_type,budget_remaining"
}
data = await make_api_request(endpoint, access_token, params)
+ # For debugging - check if frequency_control_specs was returned
+ if 'frequency_control_specs' not in data:
+ data['_meta'] = {
+ 'note': 'No frequency_control_specs field was returned by the API. This means either no frequency caps are set or the API did not include this field in the response.'
+ }
+
return json.dumps(data, indent=2)