Skip to main content
Glama

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

NameRequiredDescriptionDefault
access_tokenNo
ad_idNo

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

  • 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)
  • 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
  • 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,
  • 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)

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