Skip to main content
Glama
EfrainTorres

ArmaVita Meta Ads MCP

clone_ad_set

Duplicate Meta ad sets to replicate targeting, budget, and creative configurations for testing or scaling campaigns.

Instructions

Duplicate an ad set using Meta's local Graph copy edge.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ad_set_idYes
meta_access_tokenNo
target_campaign_idNo
name_suffixNo - Copy
include_adsNo
include_creativesNo
new_daily_budgetNo
new_targetingNo
new_statusNoPAUSED

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The tool handler function `clone_ad_set` which implements the logic for duplicating an ad set by calling `_forward_duplication_request`.
    async def clone_ad_set(
        ad_set_id: str,
        meta_access_token: Optional[str] = None,
        target_campaign_id: Optional[str] = None,
        name_suffix: Optional[str] = " - Copy",
        include_ads: bool = True,
        include_creatives: bool = True,
        new_daily_budget: Optional[float] = None,
        new_targeting: Optional[Dict[str, Any]] = None,
        new_status: Optional[str] = "PAUSED",
    ) -> str:
        """Duplicate an ad set using Meta's local Graph copy edge."""
        return await _forward_duplication_request(
            "adset",
            ad_set_id,
            meta_access_token,
            {
                "target_campaign_id": target_campaign_id,
                "name_suffix": name_suffix,
                "include_ads": include_ads,
                "include_creatives": include_creatives,
                "new_daily_budget": new_daily_budget,
                "new_targeting": new_targeting,
                "new_status": new_status,
            },
        )
  • Registration of `clone_ad_set` as an MCP tool using `@mcp_server.tool()` and `@meta_api_tool`.
    @mcp_server.tool()
    @meta_api_tool
    async def clone_ad_set(
        ad_set_id: str,
        meta_access_token: Optional[str] = None,
        target_campaign_id: Optional[str] = None,
        name_suffix: Optional[str] = " - Copy",
        include_ads: bool = True,
        include_creatives: bool = True,
        new_daily_budget: Optional[float] = None,
        new_targeting: Optional[Dict[str, Any]] = None,
        new_status: Optional[str] = "PAUSED",
    ) -> str:
        """Duplicate an ad set using Meta's local Graph copy edge."""
        return await _forward_duplication_request(
            "adset",
            ad_set_id,
            meta_access_token,
            {
                "target_campaign_id": target_campaign_id,
                "name_suffix": name_suffix,
                "include_ads": include_ads,
                "include_creatives": include_creatives,
                "new_daily_budget": new_daily_budget,
                "new_targeting": new_targeting,
                "new_status": new_status,
            },
        )
    
    
    @mcp_server.tool()
  • Helper function that performs the actual API request to the Meta Graph API copy edge for all duplication tools.
    async def _forward_duplication_request(
        resource_type: str,
        resource_id: str,
        meta_access_token: Optional[str],
        options: Dict[str, Any],
    ) -> str:
        """Execute OSS-local duplication against Graph API copy edges."""
        try:
            facebook_token = meta_access_token if meta_access_token else await auth.get_current_access_token()
            if not facebook_token:
                raise DuplicationError(
                    json.dumps(
                        {
                            "success": False,
                            "error": "authentication_required",
                            "message": "Meta Ads access token not found",
                            "details": {
                                "required": "Valid Meta access token",
                                "check": "Authenticate and retry duplication request.",
                            },
                        },
                        indent=2,
                    )
                )
    
            preflight_block = await _run_v25_duplication_preflight(resource_type, resource_id, facebook_token)
            if preflight_block:
                raise DuplicationError(
                    json.dumps(
                        {
                            "success": False,
                            "error": "v25_blocked_operation",
                            "message": "Duplication is blocked for deprecated Advantage+ Shopping/App campaign flows in v25.",
                            "details": {
                                "resource_type": resource_type,
                                "resource_id": resource_id,
                                "campaign_id": preflight_block.get("campaign_id"),
                                "campaign_name": preflight_block.get("campaign_name"),
                                "campaign_objective": preflight_block.get("campaign_objective"),
                                "smart_promotion_type": preflight_block.get("smart_promotion_type"),
                                "reason": preflight_block.get("reason"),
                            },
                            "suggestion": (
                                "Use supported Advantage+ migration or rebuild the campaign with v25-compatible "
                                "flows before attempting duplication."
                            ),
                        },
                        indent=2,
                    )
                )
    
            copy_params, warnings = _build_copy_params(resource_type, options)
            endpoint = f"{resource_id}/copies"
    
            data = await make_api_request(endpoint, facebook_token, copy_params, method="POST")
            if not isinstance(data, dict):
                raise DuplicationError(
                    json.dumps(
                        {
                            "success": False,
                            "error": "duplication_failed",
                            "message": "Unexpected response from Graph API copy edge",
                            "details": {
                                "resource_type": resource_type,
                                "resource_id": resource_id,
                                "response_type": type(data).__name__,
                            },
                        },
                        indent=2,
                    )
                )
    
            graph_error = data.get("error") if isinstance(data.get("error"), dict) else None
            if graph_error:
                code = graph_error.get("code")
                if code == 4:
                    raise RateLimitError(
                        json.dumps(
                            {
                                "error": "rate_limit_exceeded",
                                "message": graph_error.get("message") or graph_error.get("primary_text", "Meta API rate limit exceeded"),
                                "details": {
                                    "code": code,
                                    "error_subcode": graph_error.get("error_subcode"),
                                    "retry_hint": "Retry with backoff.",
                                },
                            },
                            indent=2,
                        )
                    )
    
                raise DuplicationError(
                    json.dumps(
                        _build_graph_error_payload(resource_type, resource_id, graph_error),
                        indent=2,
                    )
                )
    
            new_id = _extract_new_id(resource_type, data)
            success = bool(new_id) or bool(data.get("success") is True)
    
            return json.dumps(
                {
                    "success": success,
                    "source_id": resource_id,
                    "resource_type": resource_type,
                    "new_id": new_id,
                    "warnings": warnings,
                    "meta_response": 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. While 'Duplicate' implies a write operation, it doesn't mention permissions required, whether the original is affected, rate limits, error conditions, or what happens with the 8 optional parameters. The mention of 'Meta's local Graph copy edge' adds some technical context but not enough operational guidance.

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 a single, efficient sentence with zero wasted words. It's appropriately sized for a tool description and gets straight to the point without unnecessary elaboration.

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 complexity (9 parameters, mutation operation) and complete lack of annotations, the description is insufficient. While an output schema exists (which helps), the description doesn't address the mutation nature, parameter interactions, or sibling tool differentiation needed for a complex cloning operation. It's minimally adequate but with significant gaps.

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

Parameters2/5

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

With 0% schema description coverage for 9 parameters (1 required, 8 optional), the description provides no information about any parameters. It doesn't explain what 'ad_set_id' should be, what 'new_targeting' object should contain, what 'new_status' values are valid, or how parameters like 'include_ads' and 'include_creatives' affect the duplication. The description fails to compensate for the complete lack of schema documentation.

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 action ('Duplicate') and resource ('an ad set'), and mentions the specific technical implementation ('using Meta's local Graph copy edge'). However, it doesn't explicitly differentiate this tool from its sibling 'clone_campaign' or 'clone_ad', which would be needed for a perfect score.

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 like 'create_ad_set' or 'update_ad_set'. With multiple sibling cloning tools present (clone_ad, clone_ad_creative, clone_campaign), the lack of differentiation is a significant gap in usage guidance.

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/EfrainTorres/armavita-meta-ads-mcp'

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