meta-ads-mcp 0.4.7__py3-none-any.whl → 0.4.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
meta_ads_mcp/__init__.py CHANGED
@@ -7,7 +7,7 @@ with the Claude LLM.
7
7
 
8
8
  from meta_ads_mcp.core.server import main
9
9
 
10
- __version__ = "0.4.7"
10
+ __version__ = "0.4.9"
11
11
 
12
12
  __all__ = [
13
13
  'get_ad_accounts',
meta_ads_mcp/core/ads.py CHANGED
@@ -251,14 +251,25 @@ async def get_ad_image(access_token: str = None, ad_id: str = None) -> Image:
251
251
  if not image_hashes:
252
252
  # If no hashes found, try to extract from the first creative we found in the API
253
253
  # Get creative for ad to try to extract hash
254
- creative_json = await get_ad_creatives(ad_id, "", access_token)
254
+ creative_json = await get_ad_creatives(access_token=access_token, ad_id=ad_id)
255
255
  creative_data = json.loads(creative_json)
256
256
 
257
- # Try to extract hash from asset_feed_spec
258
- if "asset_feed_spec" in creative_data and "images" in creative_data["asset_feed_spec"]:
259
- images = creative_data["asset_feed_spec"]["images"]
260
- if images and len(images) > 0 and "hash" in images[0]:
261
- image_hashes.append(images[0]["hash"])
257
+ # Try to extract hash from data array
258
+ if "data" in creative_data and creative_data["data"]:
259
+ for creative in creative_data["data"]:
260
+ # Check object_story_spec for image hash
261
+ if "object_story_spec" in creative and "link_data" in creative["object_story_spec"]:
262
+ link_data = creative["object_story_spec"]["link_data"]
263
+ if "image_hash" in link_data:
264
+ image_hashes.append(link_data["image_hash"])
265
+ # Check direct image_hash on creative
266
+ elif "image_hash" in creative:
267
+ image_hashes.append(creative["image_hash"])
268
+ # Check asset_feed_spec for image hashes
269
+ elif "asset_feed_spec" in creative and "images" in creative["asset_feed_spec"]:
270
+ images = creative["asset_feed_spec"]["images"]
271
+ if images and len(images) > 0 and "hash" in images[0]:
272
+ image_hashes.append(images[0]["hash"])
262
273
 
263
274
  if not image_hashes:
264
275
  return "Error: No image hashes found in creative"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meta-ads-mcp
3
- Version: 0.4.7
3
+ Version: 0.4.9
4
4
  Summary: Model Context Protocol (MCP) plugin for interacting with Meta Ads API
5
5
  Project-URL: Homepage, https://github.com/pipeboard-co/meta-ads-mcp
6
6
  Project-URL: Bug Tracker, https://github.com/pipeboard-co/meta-ads-mcp/issues
@@ -1,8 +1,8 @@
1
- meta_ads_mcp/__init__.py,sha256=xGsc5RhOEUMCy8XODLn1QUM9Ixi1y9gSgLMCNPkV2oU,1182
1
+ meta_ads_mcp/__init__.py,sha256=FEQ6TsMDyEN8il0aaRLjXopQD7a-c9EbMDrK4DKE-y8,1182
2
2
  meta_ads_mcp/__main__.py,sha256=XaQt3iXftG_7f0Zu7Wop9SeFgrD2WBn0EQOaPMc27d8,207
3
3
  meta_ads_mcp/core/__init__.py,sha256=XVJjMOfdgnqxy3k8vCn2PCf7za8fMk4BdgJGiSFCVZY,1209
4
4
  meta_ads_mcp/core/accounts.py,sha256=Nmp7lPxO9wmq25jWV7_H0LIqnEbBhpCVBlLGW2HUaq0,2277
5
- meta_ads_mcp/core/ads.py,sha256=t3COpPA-TGsOYndq0vWA9XR0L7sg1cGHNrM2HK24Q6I,33424
5
+ meta_ads_mcp/core/ads.py,sha256=hrz10UKD3EHunVVnKeJcS58XE4jP-vBqZBHJee1pfZ4,34140
6
6
  meta_ads_mcp/core/ads_library.py,sha256=onStn9UkRqYDC60gOPS-iKDtP1plz6DygUb7hUZ0Jw8,2807
7
7
  meta_ads_mcp/core/adsets.py,sha256=k76rm3rkhEebUzvBnM_QaVktrzGTKvTJOtWbBd6s3i8,10399
8
8
  meta_ads_mcp/core/api.py,sha256=aAzM6Q75VQOFXtr5D-mDmBRhxWK4wsiODsJYnR3mpDI,14994
@@ -19,8 +19,8 @@ meta_ads_mcp/core/reports.py,sha256=Dv3hfsPOR7IZ9WrYrKd_6SNgZl-USIphg7knva3UYAw,
19
19
  meta_ads_mcp/core/resources.py,sha256=-zIIfZulpo76vcKv6jhAlQq91cR2SZ3cjYZt3ek3x0w,1236
20
20
  meta_ads_mcp/core/server.py,sha256=mmhtcyB7h1aO6jK4njLztPdAebPDmc3mhA7DksR1nlY,17583
21
21
  meta_ads_mcp/core/utils.py,sha256=ofKUhyo-5SZoJVuBeTVFPPQCffk0UKpwmDMrd8qQxNc,8715
22
- meta_ads_mcp-0.4.7.dist-info/METADATA,sha256=uxNO8COPSkDIPtTrw-fNDoty0k8IbFCZtVS2QfyO2lA,17580
23
- meta_ads_mcp-0.4.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
- meta_ads_mcp-0.4.7.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
25
- meta_ads_mcp-0.4.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
26
- meta_ads_mcp-0.4.7.dist-info/RECORD,,
22
+ meta_ads_mcp-0.4.9.dist-info/METADATA,sha256=7fc_dj8UNMrGhsvFiCVtj6NoX2W3FIWeYxDylOVJhjU,17580
23
+ meta_ads_mcp-0.4.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
+ meta_ads_mcp-0.4.9.dist-info/entry_points.txt,sha256=Dv2RkoBjRJBqj6CyhwqGIiwPCD-SCL1-7B9-zmVRuv0,57
25
+ meta_ads_mcp-0.4.9.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
26
+ meta_ads_mcp-0.4.9.dist-info/RECORD,,