Skip to main content
Glama

get_ad_creatives

Retrieve detailed creative information for Meta ads to analyze visual content, copy, and specifications. Use with get_ad_image for complete creative review.

Instructions

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)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ad_idYes
access_tokenNo

Implementation Reference

  • The core handler function implementing the get_ad_creatives tool. It queries the Meta Ads API endpoint /{ad_id}/adcreatives, processes the response by adding extracted image URLs using extract_creative_image_urls helper, and returns JSON. Decorated with @mcp_server.tool() for MCP registration and @meta_api_tool for shared API logic.
    @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)
  • Package-level export/registration of get_ad_creatives function from core module, making it available at package top-level.
    get_ad_creatives,
  • Uses helper function extract_creative_image_urls from utils.py to enrich creative data with direct image viewing URLs.
    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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pipeboard-co/meta-ads-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server