get_ad_creatives
Retrieve detailed creative information for a specific Meta ad using its ID. This tool enables users to analyze ad content and integrate with get_ad_image for a comprehensive view of ad visuals.
Instructions
Get creative details for a specific ad. Best if combined with get_ad_image to get the full image.
Args:
access_token: Meta API access token (optional - will use cached token if not provided)
ad_id: Meta Ads ad ID
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| access_token | No | ||
| ad_id | No |
Input Schema (JSON Schema)
{
"properties": {
"access_token": {
"default": null,
"title": "Access Token",
"type": "string"
},
"ad_id": {
"default": null,
"title": "Ad Id",
"type": "string"
}
},
"title": "get_ad_creativesArguments",
"type": "object"
}
Implementation Reference
- meta_ads_mcp/core/ads.py:161-187 (handler)The primary handler function implementing the 'get_ad_creatives' tool logic. Fetches ad creative details from the Meta Ads API endpoint /{ad_id}/adcreatives, processes the response to include extracted image viewing URLs, and returns formatted JSON.@mcp_server.tool() @meta_api_tool async def get_ad_creatives(ad_id: str, access_token: Optional[str] = None) -> str: """ Get creative details for a specific ad. Best if combined with get_ad_image to get the full image. Args: ad_id: Meta Ads ad ID access_token: Meta API access token (optional - will use cached token if not provided) """ if not ad_id: return json.dumps({"error": "No ad ID provided"}, indent=2) endpoint = f"{ad_id}/adcreatives" params = { "fields": "id,name,status,thumbnail_url,image_url,image_hash,object_story_spec,asset_feed_spec,image_urls_for_viewing" } data = await make_api_request(endpoint, access_token, params) # Add image URLs for direct viewing if available if 'data' in data: for creative in data['data']: creative['image_urls_for_viewing'] = extract_creative_image_urls(creative) return json.dumps(data, indent=2)
- meta_ads_mcp/core/__init__.py:7-7 (registration)Registers the get_ad_creatives tool by importing it from ads.py into the core module. The import triggers the @mcp_server.tool() decorator execution, making the tool available on the MCP server.from .ads import get_ads, get_ad_details, get_ad_creatives, get_ad_image, update_ad
- meta_ads_mcp/__init__.py:49-49 (registration)Re-exports the get_ad_creatives tool from core at the top-level package __init__.py, making it directly importable as meta_ads_mcp.get_ad_creatives.get_ad_creatives,
- meta_ads_mcp/core/ads.py:182-186 (helper)Uses the helper function extract_creative_image_urls from utils.py to enhance each creative with direct image viewing URLs for better usability.if 'data' in data: for creative in data['data']: creative['image_urls_for_viewing'] = extract_creative_image_urls(creative) return json.dumps(data, indent=2)