Skip to main content
Glama
johnoconnor0

Google Ads MCP Server

by johnoconnor0

google_ads_create_performance_max_campaign

Create a Performance Max campaign to unify ad optimization across Search, Display, YouTube, Gmail, Discover, and Maps using Google AI. Configure budget, conversion goals, and optional ROAS or CPA targets.

Instructions

Create a Performance Max campaign.

Performance Max uses Google's AI to optimize across all Google channels: Search, Display, YouTube, Gmail, Discover, and Maps.

Args: customer_id: Google Ads customer ID (10 digits, no hyphens) campaign_name: Name for the Performance Max campaign budget_amount: Daily budget in currency units conversion_goals_json: JSON array of conversion action names target_roas: Optional target return on ad spend (e.g., 3.0 for 300%) target_cpa: Optional target cost per acquisition (if not using ROAS)

Example: google_ads_create_performance_max_campaign( customer_id="1234567890", campaign_name="PMax - All Products", budget_amount=150.00, conversion_goals_json='["Purchase", "Add to Cart"]', target_roas=4.0 )

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customer_idYes
campaign_nameYes
budget_amountYes
conversion_goals_jsonYes
target_roasNo
target_cpaNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler function 'google_ads_create_performance_max_campaign' decorated with @mcp.tool(). It accepts customer_id, campaign_name, budget_amount, conversion_goals_json, target_roas, target_cpa. It parses conversion goals JSON, creates a PerformanceMaxCampaignConfig, and delegates to ShoppingPMaxManager.create_performance_max_campaign(). Returns a formatted result string.
    @mcp.tool()
    def google_ads_create_performance_max_campaign(
        customer_id: str,
        campaign_name: str,
        budget_amount: float,
        conversion_goals_json: str,
        target_roas: Optional[float] = None,
        target_cpa: Optional[float] = None
    ) -> str:
        """Create a Performance Max campaign.
    
        Performance Max uses Google's AI to optimize across all Google channels:
        Search, Display, YouTube, Gmail, Discover, and Maps.
    
        Args:
            customer_id: Google Ads customer ID (10 digits, no hyphens)
            campaign_name: Name for the Performance Max campaign
            budget_amount: Daily budget in currency units
            conversion_goals_json: JSON array of conversion action names
            target_roas: Optional target return on ad spend (e.g., 3.0 for 300%)
            target_cpa: Optional target cost per acquisition (if not using ROAS)
    
        Example:
            google_ads_create_performance_max_campaign(
                customer_id="1234567890",
                campaign_name="PMax - All Products",
                budget_amount=150.00,
                conversion_goals_json='["Purchase", "Add to Cart"]',
                target_roas=4.0
            )
        """
        with performance_logger.track_operation('create_performance_max', customer_id=customer_id):
            try:
                client = get_auth_manager().get_client()
                shopping_manager = ShoppingPMaxManager(client)
    
                # Parse conversion goals
                try:
                    conversion_goals = json.loads(conversion_goals_json)
                except json.JSONDecodeError:
                    return "❌ Invalid JSON format for conversion_goals_json"
    
                config = PerformanceMaxCampaignConfig(
                    name=campaign_name,
                    budget_amount=budget_amount,
                    conversion_goals=conversion_goals,
                    target_roas=target_roas,
                    target_cpa=target_cpa
                )
    
                result = shopping_manager.create_performance_max_campaign(customer_id, config)
    
                audit_logger.log_api_call(
                    customer_id=customer_id,
                    operation='create_performance_max_campaign',
                    campaign_id=result['campaign_id'],
                    status='success'
                )
    
                output = f"# πŸš€ Performance Max Campaign Created\n\n"
                output += f"**Campaign Name**: {result['campaign_name']}\n"
                output += f"**Campaign ID**: {result['campaign_id']}\n"
                output += f"**Daily Budget**: ${result['budget']:.2f}\n"
                output += f"**Bidding Strategy**: {result['bidding_strategy']}\n"
                output += f"**Status**: PAUSED\n\n"
    
                if target_roas:
                    output += f"🎯 **Target ROAS**: {target_roas:.1f}x\n\n"
                elif target_cpa:
                    output += f"🎯 **Target CPA**: ${target_cpa:.2f}\n\n"
    
                output += "## What is Performance Max?\n\n"
                output += "Performance Max uses Google's AI to show your ads across:\n"
                output += "- πŸ” Google Search\n"
                output += "- πŸ“Ί YouTube\n"
                output += "- πŸ“§ Gmail\n"
                output += "- 🌐 Display Network\n"
                output += "- πŸ“± Discover\n"
                output += "- πŸ—ΊοΈ Google Maps\n\n"
    
                output += "## Next Steps\n\n"
                output += "1. βœ… Campaign created successfully\n"
                output += "2. πŸ“¦ Create asset groups with:\n"
                output += "   - Headlines (3-15)\n"
                output += "   - Descriptions (2-5)\n"
                output += "   - Images (at least 1)\n"
                output += "   - Videos (optional)\n"
                output += "3. 🎯 Add audience signals to guide AI\n"
                output += "4. ▢️ Enable campaign when assets are ready\n\n"
    
                output += "πŸ’‘ **Tip**: Performance Max needs 6-8 weeks of learning to optimize fully.\n"
    
                return output
    
            except Exception as e:
                error_msg = ErrorHandler.handle_error(e, context="create_performance_max")
                return f"❌ Failed to create Performance Max campaign: {error_msg}"
  • The PerformanceMaxCampaignConfig dataclass defining the schema for PMax campaign creation β€” fields: name, budget_amount, conversion_goals, target_roas, target_cpa.
    class PerformanceMaxCampaignConfig:
        """Configuration for Performance Max campaign creation."""
        name: str
        budget_amount: float
        conversion_goals: List[str]
        target_roas: Optional[float] = None
        target_cpa: Optional[float] = None
  • The backend manager method 'create_performance_max_campaign' that performs the actual Google Ads API calls β€” creates a campaign budget, sets up a PERFORMANCE_MAX campaign with PAUSED status, configures bidding (TARGET_ROAS or MAXIMIZE_CONVERSIONS), and returns campaign details.
    def create_performance_max_campaign(
        self,
        customer_id: str,
        config: PerformanceMaxCampaignConfig
    ) -> Dict[str, Any]:
        """Create a Performance Max campaign.
    
        Args:
            customer_id: Customer ID (without hyphens)
            config: Performance Max campaign configuration
    
        Returns:
            Created campaign details
        """
        campaign_service = self.client.get_service("CampaignService")
        campaign_budget_service = self.client.get_service("CampaignBudgetService")
    
        # Create campaign budget
        budget_operation = self.client.get_type("CampaignBudgetOperation")
        budget = budget_operation.create
        budget.name = f"{config.name} Budget"
        budget.amount_micros = int(config.budget_amount * 1_000_000)
        budget.delivery_method = self.client.enums.BudgetDeliveryMethodEnum.STANDARD
    
        budget_response = campaign_budget_service.mutate_campaign_budgets(
            customer_id=customer_id,
            operations=[budget_operation]
        )
        budget_resource_name = budget_response.results[0].resource_name
    
        # Create Performance Max campaign
        campaign_operation = self.client.get_type("CampaignOperation")
        campaign = campaign_operation.create
    
        campaign.name = config.name
        campaign.advertising_channel_type = self.client.enums.AdvertisingChannelTypeEnum.PERFORMANCE_MAX
        campaign.status = self.client.enums.CampaignStatusEnum.PAUSED
        campaign.campaign_budget = budget_resource_name
    
        # Bidding strategy
        if config.target_roas:
            campaign.maximize_conversion_value.target_roas = config.target_roas
        elif config.target_cpa:
            campaign.maximize_conversions.target_cpa_micros = int(config.target_cpa * 1_000_000)
        else:
            campaign.maximize_conversions.target_cpa_micros = 0
    
        # Create campaign
        response = campaign_service.mutate_campaigns(
            customer_id=customer_id,
            operations=[campaign_operation]
        )
    
        campaign_id = response.results[0].resource_name.split('/')[-1]
    
        return {
            'campaign_id': campaign_id,
            'campaign_name': config.name,
            'resource_name': response.results[0].resource_name,
            'budget': config.budget_amount,
            'bidding_strategy': 'TARGET_ROAS' if config.target_roas else 'MAXIMIZE_CONVERSIONS'
        }
  • Registration entry in _TOOL_MODULES list that maps 'shopping_pmax' to the module 'tools.shopping_pmax.mcp_tools_shopping_pmax' and function 'register_shopping_pmax_tools'.
    ("shopping_pmax", "tools.shopping_pmax.mcp_tools_shopping_pmax", "register_shopping_pmax_tools"),
  • The 'register_shopping_pmax_tools' function definition that receives the MCP instance and registers the tool via the @mcp.tool() decorator.
    def register_shopping_pmax_tools(mcp):
        """Register all Shopping and Performance Max MCP tools."""
Behavior3/5

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

No annotations are provided, so the description must disclose behavioral traits. It describes the AI-optimization nature and parameter details but does not mention side effects (e.g., immediate spending, permissions needed, reversibility). This is adequate but lacks depth.

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 concise and well-structured: a clear purpose statement, a line explaining Performance Max, a list of arguments with descriptions, and an example. Every sentence adds value without fluff.

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?

Given the complexity (6 parameters, create operation), the description covers parameter semantics and provides an example. It lacks prerequisites (e.g., valid customer_id) and output description (but output schema exists). Slightly incomplete but mostly sufficient.

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?

Schema description coverage is 0%, so the description fully compensates by explaining each parameter: customer_id (10 digits, no hyphens), campaign_name, budget_amount (daily budget), conversion_goals_json (JSON array), target_roas (optional), target_cpa (optional). The example demonstrates usage, adding significant value.

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 tool creates a Performance Max campaign and explains that it optimizes across multiple Google channels (Search, Display, YouTube, Gmail, Discover, Maps), distinguishing it from other campaign creation tools like create_app_campaign or create_shopping_campaign.

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

Usage Guidelines3/5

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

The description implies the tool is for creating Performance Max campaigns but does not explicitly state when to use it versus alternatives like google_ads_create_campaign or google_ads_create_app_campaign. No exclusions or when-not-to-use guidance is provided.

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/johnoconnor0/google-ads-mcp'

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