Skip to main content
Glama

update_ad

Modify Meta advertising campaign settings including status, bid amount, creative content, and tracking specifications to optimize ad performance.

Instructions

Update an ad with new settings.

Args:
    ad_id: Meta Ads ad ID
    status: Update ad status (ACTIVE, PAUSED, etc.)
    bid_amount: Bid amount in account currency (in cents for USD)
    tracking_specs: Optional tracking specifications (e.g., for pixel events).
    creative_id: ID of the creative to associate with this ad (changes the ad's image/content)
    access_token: Meta API access token (optional - will use cached token if not provided)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ad_idYes
statusNo
bid_amountNo
tracking_specsNo
creative_idNo
access_tokenNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'update_ad' MCP tool. It updates Meta Ads ad properties such as status, bid_amount, tracking_specs, or swaps the creative using creative_id. Decorated with @mcp_server.tool() for MCP registration and @meta_api_tool for API handling.
    @mcp_server.tool()
    @meta_api_tool
    async def update_ad(
        ad_id: str,
        status: Optional[str] = None,
        bid_amount: Optional[int] = None,
        tracking_specs: Optional[List[Dict[str, Any]]] = None,
        creative_id: Optional[str] = None,
        access_token: Optional[str] = None
    ) -> str:
        """
        Update an ad with new settings.
        
        Args:
            ad_id: Meta Ads ad ID
            status: Update ad status (ACTIVE, PAUSED, etc.)
            bid_amount: Bid amount in account currency (in cents for USD)
            tracking_specs: Optional tracking specifications (e.g., for pixel events).
            creative_id: ID of the creative to associate with this ad (changes the ad's image/content)
            access_token: Meta API access token (optional - will use cached token if not provided)
        """
        if not ad_id:
            return json.dumps({"error": "Ad ID is required"}, indent=2)
    
        params = {}
        if status:
            params["status"] = status
        if bid_amount is not None:
            # Ensure bid_amount is sent as a string if it's not null
            params["bid_amount"] = str(bid_amount)
        if tracking_specs is not None: # Add tracking_specs to params if provided
            params["tracking_specs"] = json.dumps(tracking_specs) # Needs to be JSON encoded string
        if creative_id is not None:
            # Creative parameter needs to be a JSON object containing creative_id
            params["creative"] = json.dumps({"creative_id": creative_id})
    
        if not params:
            return json.dumps({"error": "No update parameters provided (status, bid_amount, tracking_specs, or creative_id)"}, indent=2)
    
        endpoint = f"{ad_id}"
        try:
            data = await make_api_request(endpoint, access_token, params, method='POST')
            return json.dumps(data, indent=2)
        except Exception as e:
            return json.dumps({"error": f"Failed to update ad: {str(e)}"}, indent=2)
  • Package-level export of the update_ad function in __all__ for easy import.
        'update_ad',
        'get_insights',
        # 'get_login_link' is conditionally exported via core.__all__
        'login_cli',
        'main',
        'search_interests',
        'get_interest_suggestions',
        'estimate_audience_size',
        'search_behaviors',
        'search_demographics',
        'search_geo_locations'
    ]
  • Import of update_ad from core module to make it available at package level.
        update_ad,
        get_insights,
        login_cli,
        main,
        search_interests,
        get_interest_suggestions,
        estimate_audience_size,
        search_behaviors,
        search_demographics,
        search_geo_locations
    )
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. While 'Update' implies mutation, the description doesn't specify permission requirements, whether changes are reversible, rate limits, error conditions, or what happens to existing ad settings not mentioned. For a mutation tool with 6 parameters and no annotation coverage, this is a significant gap in behavioral context.

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 followed by well-organized parameter explanations. Every sentence earns its place, and the bullet-point style for parameters makes it scannable. No wasted words or redundant information is present.

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 this is a mutation tool with 6 parameters, no annotations, but with an output schema (which means return values are documented elsewhere), the description is moderately complete. It covers parameter semantics well but lacks behavioral context, usage guidelines, and differentiation from siblings. The presence of an output schema helps, but for a complex update operation, more contextual information would be beneficial.

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

Parameters4/5

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

The description provides excellent parameter semantics despite 0% schema description coverage. It clarifies that 'ad_id' is a 'Meta Ads ad ID', 'bid_amount' is 'in account currency (in cents for USD)', 'tracking_specs' are 'Optional tracking specifications (e.g., for pixel events)', and 'creative_id' 'changes the ad's image/content'. This adds substantial meaning beyond the bare schema, though it doesn't cover all parameters equally (status explanation is minimal).

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 the verb ('Update') and resource ('an ad with new settings'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'update_ad_creative' beyond the resource name, missing explicit distinction about what makes this ad update different from creative updates.

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?

No guidance is provided about when to use this tool versus alternatives like 'update_ad_creative' or 'update_adset'. The description lacks context about prerequisites, dependencies, or scenarios where this specific ad update tool is appropriate versus other update operations in the system.

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