Skip to main content
Glama

create_ad

Create new Meta ads using existing creatives by specifying account, ad set, creative ID, and optional bid or tracking parameters.

Instructions

Create a new ad with an existing creative.

Args:
    account_id: Meta Ads account ID (format: act_XXXXXXXXX)
    name: Ad name
    adset_id: Ad set ID where this ad will be placed
    creative_id: ID of an existing creative to use
    status: Initial ad status (default: PAUSED)
    bid_amount: Optional bid amount in account currency (in cents)
    tracking_specs: Optional tracking specifications (e.g., for pixel events).
                  Example: [{"action.type":"offsite_conversion","fb_pixel":["YOUR_PIXEL_ID"]}]
    access_token: Meta API access token (optional - will use cached token if not provided)

Note:
    Dynamic Creative creatives require the parent ad set to have `is_dynamic_creative=true`.
    Otherwise, ad creation will fail with error_subcode 1885998.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYes
nameYes
adset_idYes
creative_idYes
statusNoPAUSED
bid_amountNo
tracking_specsNo
access_tokenNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'create_ad' tool. Decorated with @mcp_server.tool() which registers it as an MCP tool, and @meta_api_tool for API handling. Creates a new ad in the Meta Ads API using the provided parameters by making a POST request to /{account_id}/ads endpoint.
    @mcp_server.tool()
    @meta_api_tool
    async def create_ad(
        account_id: str,
        name: str,
        adset_id: str,
        creative_id: str,
        status: str = "PAUSED",
        bid_amount: Optional[int] = None,
        tracking_specs: Optional[List[Dict[str, Any]]] = None,
        access_token: Optional[str] = None
    ) -> str:
        """
        Create a new ad with an existing creative.
        
        Args:
            account_id: Meta Ads account ID (format: act_XXXXXXXXX)
            name: Ad name
            adset_id: Ad set ID where this ad will be placed
            creative_id: ID of an existing creative to use
            status: Initial ad status (default: PAUSED)
            bid_amount: Optional bid amount in account currency (in cents)
            tracking_specs: Optional tracking specifications (e.g., for pixel events).
                          Example: [{"action.type":"offsite_conversion","fb_pixel":["YOUR_PIXEL_ID"]}]
            access_token: Meta API access token (optional - will use cached token if not provided)
    
        Note:
            Dynamic Creative creatives require the parent ad set to have `is_dynamic_creative=true`.
            Otherwise, ad creation will fail with error_subcode 1885998.
        """
        # Check required parameters
        if not account_id:
            return json.dumps({"error": "No account ID provided"}, indent=2)
        
        if not name:
            return json.dumps({"error": "No ad name provided"}, indent=2)
        
        if not adset_id:
            return json.dumps({"error": "No ad set ID provided"}, indent=2)
        
        if not creative_id:
            return json.dumps({"error": "No creative ID provided"}, indent=2)
        
        endpoint = f"{account_id}/ads"
        
        params = {
            "name": name,
            "adset_id": adset_id,
            "creative": {"creative_id": creative_id},
            "status": status
        }
        
        # Add bid amount if provided
        if bid_amount is not None:
            params["bid_amount"] = str(bid_amount)
            
        # Add tracking specs if provided
        if tracking_specs is not None:
            params["tracking_specs"] = json.dumps(tracking_specs) # Needs to be JSON encoded string
        
        try:
            data = await make_api_request(endpoint, access_token, params, method="POST")
            return json.dumps(data, indent=2)
        except Exception as e:
            error_msg = str(e)
            return json.dumps({
                "error": "Failed to create ad",
                "details": error_msg,
                "params_sent": params
            }, indent=2)
  • The @mcp_server.tool() decorator registers the create_ad function as an MCP tool named 'create_ad'. @meta_api_tool adds additional API-specific functionality.
    @mcp_server.tool()
    @meta_api_tool
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it's a creation/mutation operation (implied by 'Create'), mentions authentication needs (access_token parameter), and provides critical error context (Dynamic Creative requirement with specific error code 1885998). It lacks details on rate limits, permissions, or what happens on success/failure beyond the error note.

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

Conciseness5/5

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

The description is efficiently structured with a clear purpose statement, organized parameter explanations in bullet-like format, and a focused 'Note' section for critical constraints. Every sentence adds value: the opening defines the tool, parameter descriptions clarify usage, and the note prevents common errors. No wasted words.

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

Completeness4/5

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

For a creation tool with 8 parameters, 0% schema coverage, no annotations, but with an output schema, the description is nearly complete. It covers purpose, parameters, prerequisites, and error conditions well. The output schema likely handles return values, so the description appropriately focuses on input semantics and behavioral context. Minor gaps include lack of permission requirements or rate limit information.

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?

With 0% schema description coverage, the description fully compensates by providing semantic meaning for all 8 parameters. It explains what each parameter represents (e.g., 'Meta Ads account ID', 'Ad name', 'Optional bid amount in account currency'), provides format examples (act_XXXXXXXXX), default values (status default: PAUSED), and even includes a concrete example for tracking_specs. This adds substantial value beyond the bare schema.

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

Purpose5/5

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

The description clearly states the specific action ('Create a new ad') and resource ('with an existing creative'), distinguishing it from sibling tools like create_ad_creative (which creates creatives) and update_ad (which modifies existing ads). The verb+resource combination is precise and unambiguous.

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

Usage Guidelines4/5

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

The description provides clear context about when to use this tool (to create ads with existing creatives) and includes a critical 'Note' about prerequisites for Dynamic Creative creatives. However, it doesn't explicitly contrast when to use this versus alternatives like create_ad_creative or update_ad, nor does it mention when NOT to use it (e.g., for creating ads without existing creatives).

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