Skip to main content
Glama

update_ad_creative

Modify existing Meta ad creative content and settings, including copy, headlines, descriptions, and call-to-action elements.

Instructions

Update an existing ad creative with new content or settings.

Args:
    creative_id: Meta Ads creative ID to update
    access_token: Meta API access token (optional - will use cached token if not provided)
    name: New creative name
    message: New ad copy/text
    headline: Single headline for simple ads (cannot be used with headlines)
    headlines: New list of headlines for dynamic creative testing (cannot be used with headline)
    description: Single description for simple ads (cannot be used with descriptions)
    descriptions: New list of descriptions for dynamic creative testing (cannot be used with description)
    dynamic_creative_spec: New dynamic creative optimization settings
    call_to_action_type: New call to action button type
    lead_gen_form_id: Lead generation form ID for lead generation campaigns. Required when using
                     lead generation CTAs like 'SIGN_UP', 'GET_OFFER', 'SUBSCRIBE', etc.

Returns:
    JSON response with updated creative details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
creative_idYes
access_tokenNo
nameNo
messageNo
headlineNo
headlinesNo
descriptionNo
descriptionsNo
dynamic_creative_specNo
call_to_action_typeNo
lead_gen_form_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler implementation for the update_ad_creative MCP tool. It performs validation on inputs like headlines and descriptions, constructs the appropriate object_story_spec or asset_feed_spec for dynamic creatives, and makes a POST request to the Meta Ads API to update the creative. Includes decorators for MCP registration (@mcp_server.tool()) and API handling (@meta_api_tool).
    @mcp_server.tool()
    @meta_api_tool
    async def update_ad_creative(
        creative_id: str,
        access_token: Optional[str] = None,
        name: Optional[str] = None,
        message: Optional[str] = None,
        headline: Optional[str] = None,
        headlines: Optional[List[str]] = None,
        description: Optional[str] = None,
        descriptions: Optional[List[str]] = None,
        dynamic_creative_spec: Optional[Dict[str, Any]] = None,
        call_to_action_type: Optional[str] = None,
        lead_gen_form_id: Optional[str] = None
    ) -> str:
        """
        Update an existing ad creative with new content or settings.
        
        Args:
            creative_id: Meta Ads creative ID to update
            access_token: Meta API access token (optional - will use cached token if not provided)
            name: New creative name
            message: New ad copy/text
            headline: Single headline for simple ads (cannot be used with headlines)
            headlines: New list of headlines for dynamic creative testing (cannot be used with headline)
            description: Single description for simple ads (cannot be used with descriptions)
            descriptions: New list of descriptions for dynamic creative testing (cannot be used with description)
            dynamic_creative_spec: New dynamic creative optimization settings
            call_to_action_type: New call to action button type
            lead_gen_form_id: Lead generation form ID for lead generation campaigns. Required when using
                             lead generation CTAs like 'SIGN_UP', 'GET_OFFER', 'SUBSCRIBE', etc.
        
        Returns:
            JSON response with updated creative details
        """
        # Check required parameters
        if not creative_id:
            return json.dumps({"error": "No creative ID provided"}, indent=2)
        
        # Validate headline/description parameters - cannot mix simple and complex
        if headline and headlines:
            return json.dumps({"error": "Cannot specify both 'headline' and 'headlines'. Use 'headline' for single headline or 'headlines' for multiple."}, indent=2)
        
        if description and descriptions:
            return json.dumps({"error": "Cannot specify both 'description' and 'descriptions'. Use 'description' for single description or 'descriptions' for multiple."}, indent=2)
        
        # Validate dynamic creative parameters (plural forms only)
        if headlines:
            if len(headlines) > 5:
                return json.dumps({"error": "Maximum 5 headlines allowed for dynamic creatives"}, indent=2)
            for i, h in enumerate(headlines):
                if len(h) > 40:
                    return json.dumps({"error": f"Headline {i+1} exceeds 40 character limit"}, indent=2)
        
        if descriptions:
            if len(descriptions) > 5:
                return json.dumps({"error": "Maximum 5 descriptions allowed for dynamic creatives"}, indent=2)
            for i, d in enumerate(descriptions):
                if len(d) > 125:
                    return json.dumps({"error": f"Description {i+1} exceeds 125 character limit"}, indent=2)
        
        # Prepare the update data
        update_data = {}
        
        if name:
            update_data["name"] = name
        
        # Choose between asset_feed_spec (dynamic creative) or object_story_spec (traditional)
        # ONLY use asset_feed_spec when user explicitly provides plural parameters (headlines/descriptions)
        if headlines or descriptions or dynamic_creative_spec:
            # Handle dynamic creative assets via asset_feed_spec
            asset_feed_spec = {}
            
            # Add required ad_formats field for dynamic creatives
            asset_feed_spec["ad_formats"] = ["SINGLE_IMAGE"]
            
            # Handle headlines - Meta API uses "titles" not "headlines" in asset_feed_spec
            if headlines:
                asset_feed_spec["titles"] = [{"text": headline_text} for headline_text in headlines]
                
            # Handle descriptions  
            if descriptions:
                asset_feed_spec["descriptions"] = [{"text": description_text} for description_text in descriptions]
            
            # Add message as bodies - Meta API uses "bodies" not "primary_texts" in asset_feed_spec
            if message:
                asset_feed_spec["bodies"] = [{"text": message}]
            
            # Add call_to_action_types if provided
            if call_to_action_type:
                asset_feed_spec["call_to_action_types"] = [call_to_action_type]
            
            update_data["asset_feed_spec"] = asset_feed_spec
        else:
            # Use traditional object_story_spec with link_data for simple creatives
            if message or headline or description or call_to_action_type or lead_gen_form_id:
                update_data["object_story_spec"] = {"link_data": {}}
                
                if message:
                    update_data["object_story_spec"]["link_data"]["message"] = message
                
                # Add headline (singular) to link_data
                if headline:
                    update_data["object_story_spec"]["link_data"]["name"] = headline
                
                # Add description (singular) to link_data
                if description:
                    update_data["object_story_spec"]["link_data"]["description"] = description
                
                # Add call_to_action to link_data for simple creatives
                if call_to_action_type or lead_gen_form_id:
                    cta_data = {}
                    if call_to_action_type:
                        cta_data["type"] = call_to_action_type
                    
                    # Add lead form ID to value object if provided (required for lead generation campaigns)
                    if lead_gen_form_id:
                        cta_data["value"] = {"lead_gen_form_id": lead_gen_form_id}
                    
                    if cta_data:
                        update_data["object_story_spec"]["link_data"]["call_to_action"] = cta_data
        
        # Add dynamic creative spec if provided
        if dynamic_creative_spec:
            update_data["dynamic_creative_spec"] = dynamic_creative_spec
        
        # Prepare the API endpoint for updating the creative
        endpoint = f"{creative_id}"
        
        try:
            # Make API request to update the creative
            data = await make_api_request(endpoint, access_token, update_data, method="POST")
            
            # If successful, get more details about the updated creative
            if "id" in data:
                creative_endpoint = f"{creative_id}"
                creative_params = {
                    "fields": "id,name,status,thumbnail_url,image_url,image_hash,object_story_spec,url_tags,link_url,dynamic_creative_spec"
                }
                
                creative_details = await make_api_request(creative_endpoint, access_token, creative_params)
                return json.dumps({
                    "success": True,
                    "creative_id": creative_id,
                    "details": creative_details
                }, indent=2)
            
            return json.dumps(data, indent=2)
        
        except Exception as e:
            return json.dumps({
                "error": "Failed to update ad creative",
                "details": str(e),
                "update_data_sent": update_data
            }, indent=2)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is an update operation (implying mutation) but doesn't mention permission requirements, whether changes are reversible, rate limits, error conditions, or what happens to unspecified fields. The 'Returns' section mentions JSON response but lacks detail on success/failure patterns. For a mutation tool with 11 parameters and zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, Args, Returns) and uses bullet-like formatting for parameters. Each parameter explanation is concise yet informative. The opening sentence clearly states the tool's purpose. However, the parameter section is quite long (11 items), which is necessary given the complexity but affects overall brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (11 parameters, mutation operation, no annotations), the description does well on parameter semantics but lacks behavioral context. The presence of an output schema means the description doesn't need to detail return values, but it should address mutation-specific concerns like permissions, idempotency, and error handling. The parameter documentation is comprehensive, but behavioral transparency gaps remain.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides extensive parameter documentation beyond the 0% schema description coverage. It explains creative_id is the 'Meta Ads creative ID to update', clarifies optionality of access_token, distinguishes between headline/headlines and description/descriptions with mutual exclusivity rules, explains lead_gen_form_id requirements for specific CTA types, and gives context for dynamic_creative_spec. This fully compensates for the schema's lack of descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Update an existing ad creative with new content or settings' - a specific verb (update) and resource (ad creative). It distinguishes from siblings like create_ad_creative (creation vs update) and update_ad/adset/campaign (different resource types). However, it doesn't explicitly contrast with get_ad_creatives or other read operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing creative), when to choose update_ad_creative over create_ad_creative, or how it relates to other update operations like update_ad. The only implicit guidance is in the name itself - updating vs creating.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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