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.

Fix get_ad_image JSON parsing error (list type)

Yves Junqueiraf292c70c3fd7
diff --git a/meta_ads_mcp/__init__.py b/meta_ads_mcp/__init__.py
index 5a29081..48c11c4 100644
--- a/meta_ads_mcp/__init__.py
+++ b/meta_ads_mcp/__init__.py
@@ -7,7 +7,7 @@ with the Claude LLM.
from meta_ads_mcp.core.server import main
-__version__ = "0.4.8"
+__version__ = "0.4.9"
__all__ = [
'get_ad_accounts',
diff --git a/meta_ads_mcp/core/ads.py b/meta_ads_mcp/core/ads.py
index 488c32f..7b9dd43 100644
--- a/meta_ads_mcp/core/ads.py
+++ b/meta_ads_mcp/core/ads.py
@@ -252,9 +252,7 @@ async def get_ad_image(access_token: str = None, ad_id: str = None) -> Image:
# If no hashes found, try to extract from the first creative we found in the API
# Get creative for ad to try to extract hash
creative_json = await get_ad_creatives(access_token=access_token, ad_id=ad_id)
- # The result is wrapped by @meta_api_tool, so we need to extract the data
- creative_wrapper = json.loads(creative_json)
- creative_data = json.loads(creative_wrapper["data"])
+ creative_data = json.loads(creative_json)
# Try to extract hash from data array
if "data" in creative_data and creative_data["data"]:
@@ -393,9 +391,7 @@ async def save_ad_image_locally(access_token: str = None, ad_id: str = None, out
if not image_hashes:
# Fallback attempt (as in get_ad_image)
creative_json = await get_ad_creatives(ad_id=ad_id, access_token=access_token) # Ensure ad_id is passed correctly
- # The result is wrapped by @meta_api_tool, so we need to extract the data
- creative_wrapper = json.loads(creative_json)
- creative_data_list = json.loads(creative_wrapper["data"])
+ creative_data_list = json.loads(creative_json)
if 'data' in creative_data_list and creative_data_list['data']:
first_creative = creative_data_list['data'][0]
if 'object_story_spec' in first_creative and 'link_data' in first_creative['object_story_spec'] and 'image_hash' in first_creative['object_story_spec']['link_data']:
diff --git a/pyproject.toml b/pyproject.toml
index c2d7faa..791942e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "meta-ads-mcp"
-version = "0.4.8"
+version = "0.4.9"
description = "Model Context Protocol (MCP) plugin for interacting with Meta Ads API"
readme = "README.md"
requires-python = ">=3.10"