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.
Python advertisingai-agentschatgptclaudefacebook-adsinstagram-adsmcpmeta-adsmodel-context-protocolpipeboard
fix: put description back in video_data, remove deprecated link_description from CTA
Yves Junqueiraed14656632eb
diff --git a/meta_ads_mcp/core/ads.py b/meta_ads_mcp/core/ads.pyindex f228311..ebdfb51 100644--- a/meta_ads_mcp/core/ads.py+++ b/meta_ads_mcp/core/ads.py@@ -963,6 +963,21 @@ async def create_ad_creative(# Track if this is a video creativeis_video = bool(video_id)+ # Meta API v24 REQUIRES a thumbnail (image_hash or image_url) in video_data.+ # If the caller didn't provide one, auto-fetch from the video object.+ if is_video and not thumbnail_url:+ try:+ video_info = await make_api_request(+ video_id, access_token, {"fields": "picture"}+ )+ if isinstance(video_info, dict) and "picture" in video_info:+ thumbnail_url = video_info["picture"]+ logger.info(f"Auto-fetched video thumbnail: {thumbnail_url[:80]}...")+ else:+ logger.warning(f"Could not auto-fetch thumbnail for video {video_id}: {video_info}")+ except Exception as e:+ logger.warning(f"Failed to auto-fetch thumbnail for video {video_id}: {e}")+if use_asset_feed:# Build the media array from the provided sourceif is_video:@@ -1032,11 +1047,12 @@ async def create_ad_creative(if is_video:# video_data does NOT support "link" directly — URL goes in# call_to_action.value.link or is handled by asset_feed_spec.link_urls.+ video_anchor = {"video_id": video_id}+ if thumbnail_url:+ video_anchor["image_url"] = thumbnail_urlcreative_data["object_story_spec"] = {"page_id": page_id,- "video_data": {- "video_id": video_id,- }+ "video_data": video_anchor}else:creative_data["object_story_spec"] = {@@ -1050,18 +1066,7 @@ async def create_ad_creative(# Use object_story_spec with video_data for simple video creatives.# NOTE: video_data does NOT support a "link" field directly.# The destination URL goes in call_to_action.value.link.-- # Meta API v24 REQUIRES a thumbnail (image_hash or image_url) in video_data.- # If the caller didn't provide one, auto-fetch from the video object.- if not thumbnail_url:- try:- video_info = await make_api_request(- video_id, access_token, {"fields": "picture"}- )- thumbnail_url = video_info.get("picture")- except Exception:- pass # Best-effort; Meta API will return a clear error if missing-+ # Thumbnail auto-fetch is handled earlier (before use_asset_feed branch).video_data = {"video_id": video_id,}@@ -1075,9 +1080,8 @@ async def create_ad_creative(if headline:video_data["title"] = headline- # NOTE: video_data does NOT support "description" directly.- # For video creatives, description can go in- # call_to_action.value.link_description if needed.+ if description:+ video_data["description"] = description# Build call_to_action with the destination URL.# For video creatives, link_url MUST go in call_to_action.value.link@@ -1085,8 +1089,6 @@ async def create_ad_creative(cta_value = {}if link_url:cta_value["link"] = link_url- if description:- cta_value["link_description"] = descriptionif lead_gen_form_id:cta_value["lead_gen_form_id"] = lead_gen_form_idcta_type = call_to_action_type or ("LEARN_MORE" if link_url else None)diff --git a/tests/test_video_creatives.py b/tests/test_video_creatives.pyindex 85ec45a..8d85945 100644--- a/tests/test_video_creatives.py+++ b/tests/test_video_creatives.py@@ -72,10 +72,9 @@ async def test_simple_video_creative_uses_video_data():assert "link" not in video_data, "link must NOT be in video_data directly"assert video_data["message"] == "Check out this video"assert video_data["title"] == "Watch Now"- assert "description" not in video_data, "description is NOT supported in video_data"+ assert video_data["description"] == "Amazing content"assert video_data["call_to_action"]["type"] == "LEARN_MORE"assert video_data["call_to_action"]["value"]["link"] == "https://example.com/"- assert video_data["call_to_action"]["value"]["link_description"] == "Amazing content"@pytest.mark.asyncio@@ -219,7 +218,11 @@ async def test_video_creative_with_dof_optimization():}mock_api.side_effect = [+ # 1) Auto-fetch video thumbnail+ {"picture": "https://example.com/auto-thumb.jpg"},+ # 2) POST create creative{"id": "creative_vid_5"},+ # 3) GET creative details{"id": "creative_vid_5", "name": "Video DOF", "status": "ACTIVE"}]@@ -233,14 +236,16 @@ async def test_video_creative_with_dof_optimization():access_token="test_token")- creative_data = mock_api.call_args_list[0][0][2]+ creative_data = mock_api.call_args_list[1][0][2]afs = creative_data["asset_feed_spec"]assert afs["optimization_type"] == "DEGREES_OF_FREEDOM"assert "videos" in afs- assert afs["videos"] == [{"video_id": "vid_777888"}]+ # Auto-fetched thumbnail should be included in videos array+ assert afs["videos"] == [{"video_id": "vid_777888", "thumbnail_url": "https://example.com/auto-thumb.jpg"}]- # video_data anchor should not contain "link"+ # video_data anchor should have image_url and not "link"+ assert creative_data["object_story_spec"]["video_data"]["image_url"] == "https://example.com/auto-thumb.jpg"assert "link" not in creative_data["object_story_spec"]["video_data"]