Skip to main content
Glama
johnoconnor0

Google Ads MCP Server

by johnoconnor0

google_ads_set_ad_group_url_suffix

Set the final URL suffix for a Google Ads ad group, overriding the campaign-level suffix. Append tracking parameters or clear to inherit campaign suffix.

Instructions

Set the Final URL suffix for an ad group. This overrides the campaign-level suffix for ads in this ad group.

Args: customer_id: Customer ID (without hyphens) ad_group_id: Ad group ID to update url_suffix: URL parameters to append (e.g., 'utm_source=google&utm_medium=cpc&sm_kw=removable-bollards'). Pass empty string to clear and inherit campaign suffix.

Returns: Success message with the applied suffix

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customer_idYes
ad_group_idYes
url_suffixYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler that sets the Final URL suffix for an ad group. Validates inputs, delegates to AdGroupManager.set_ad_group_url_suffix, logs the operation, invalidates cache, and returns a user-facing success/error message.
    @mcp.tool()
    def google_ads_set_ad_group_url_suffix(
        customer_id: str,
        ad_group_id: str,
        url_suffix: str
    ) -> str:
        """
        Set the Final URL suffix for an ad group. This overrides the campaign-level suffix for ads in this ad group.
    
        Args:
            customer_id: Customer ID (without hyphens)
            ad_group_id: Ad group ID to update
            url_suffix: URL parameters to append (e.g., 'utm_source=google&utm_medium=cpc&sm_kw=removable-bollards'). Pass empty string to clear and inherit campaign suffix.
    
        Returns:
            Success message with the applied suffix
        """
        with performance_logger.track_operation('set_ad_group_url_suffix', customer_id=customer_id):
            try:
                client = get_auth_manager().get_client()
                ad_group_manager = AdGroupManager(client)
    
                ad_group_manager.set_ad_group_url_suffix(
                    customer_id, ad_group_id, url_suffix
                )
    
                audit_logger.log_api_call(
                    customer_id=customer_id,
                    operation="set_ad_group_url_suffix",
                    resource_type="ad_group",
                    resource_id=ad_group_id,
                    action="update",
                    result="success",
                    details={'url_suffix': url_suffix}
                )
    
                get_cache_manager().invalidate(customer_id, ResourceType.AD_GROUP)
    
                if url_suffix:
                    return (
                        f"✅ Ad group {ad_group_id} Final URL suffix updated!\n\n"
                        f"**Suffix:** `?{url_suffix}`\n\n"
                        f"This overrides the campaign-level suffix for ads in this ad group."
                    )
                else:
                    return f"✅ Ad group {ad_group_id} Final URL suffix cleared. Will inherit campaign suffix."
    
            except Exception as e:
                error_msg = ErrorHandler.handle_error(e, context="set_ad_group_url_suffix")
                return f"❌ Failed to set ad group URL suffix: {error_msg}"
  • Helper method in AdGroupManager that delegates to update_ad_group with the final_url_suffix field.
    def set_ad_group_url_suffix(
        self,
        customer_id: str,
        ad_group_id: str,
        url_suffix: str
    ) -> Dict[str, Any]:
        """
        Set the Final URL suffix for an ad group.
    
        Args:
            customer_id: Customer ID
            ad_group_id: Ad group ID
            url_suffix: URL suffix string (e.g., 'sm_kw=removable-bollards')
    
        Returns:
            Operation result
        """
        return self.update_ad_group(
            customer_id,
            ad_group_id,
            {"final_url_suffix": url_suffix}
        )
  • Core update method in AdGroupManager that builds the Google Ads API AdGroupOperation, applies a field mask, and calls mutate_ad_groups. Handles final_url_suffix among other fields.
    def update_ad_group(
        self,
        customer_id: str,
        ad_group_id: str,
        updates: Dict[str, Any]
    ) -> Dict[str, Any]:
        """
        Update ad group settings.
    
        Args:
            customer_id: Customer ID
            ad_group_id: Ad group ID
            updates: Dictionary of fields to update (name, status, cpc_bid_micros, etc.)
    
        Returns:
            Operation result
        """
        ad_group_service = self.client.get_service("AdGroupService")
    
        ad_group_operation = self.client.get_type("AdGroupOperation")
        ad_group = ad_group_operation.update
    
        ad_group.resource_name = ad_group_service.ad_group_path(customer_id, ad_group_id)
    
        # Track updated fields for field mask
        update_mask_paths = []
    
        # Update name
        if "name" in updates:
            ad_group.name = updates["name"]
            update_mask_paths.append("name")
    
        # Update status
        if "status" in updates:
            ad_group.status = self.client.enums.AdGroupStatusEnum[updates["status"]]
            update_mask_paths.append("status")
    
        # Update CPC bid
        if "cpc_bid_micros" in updates:
            ad_group.cpc_bid_micros = updates["cpc_bid_micros"]
            update_mask_paths.append("cpc_bid_micros")
    
        # Update CPM bid
        if "cpm_bid_micros" in updates:
            ad_group.cpm_bid_micros = updates["cpm_bid_micros"]
            update_mask_paths.append("cpm_bid_micros")
    
        # Update CPV bid
        if "cpv_bid_micros" in updates:
            ad_group.cpv_bid_micros = updates["cpv_bid_micros"]
            update_mask_paths.append("cpv_bid_micros")
    
        # Update Final URL suffix
        if "final_url_suffix" in updates:
            ad_group.final_url_suffix = updates["final_url_suffix"]
            update_mask_paths.append("final_url_suffix")
    
        # Set field mask
        self.client.copy_from(
            ad_group_operation.update_mask,
            field_mask_pb2.FieldMask(paths=update_mask_paths)
        )
    
        # Update ad group
        response = ad_group_service.mutate_ad_groups(
            customer_id=customer_id,
            operations=[ad_group_operation]
        )
    
        logger.info(f"Updated ad group {ad_group_id}: {', '.join(update_mask_paths)}")
    
        return {
            "ad_group_id": ad_group_id,
            "updated_fields": update_mask_paths,
            "message": f"Ad group updated successfully"
        }
  • Registration function that registers all ad group tools (including google_ads_set_ad_group_url_suffix) with the MCP server via @mcp.tool() decorators.
    def register_ad_group_tools(mcp: FastMCP):
        """Register ad group management tools with MCP server."""
Behavior3/5

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

With no annotations, the description carries the transparency burden. It explains overriding behavior and clearing via empty string, but does not disclose side effects, permissions, or failure modes. Partial but not fully transparent.

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 with separate sections for purpose, args, and returns. Every sentence adds value, with no redundancy or unnecessary details.

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 simple set operation, the description covers main purpose, parameter semantics, and basic behavior (override/inherit). It lacks error handling or permission details, but the task is straightforward. A minimal output schema is implied but not described, which is acceptable.

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 meaningful semantics beyond the input schema: customer_id format (no hyphens), url_suffix example and behavior for empty string. Schema has 0% description coverage, so the description fully compensates with clear parameter guidance.

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 sets the Final URL suffix for an ad group, overriding campaign-level suffixes. It uses specific verb-resource pairing and distinguishes from the campaign-level sibling tool.

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 explains when to use (setting/clearing ad group suffix) and the effect of an empty string to inherit campaign suffix. It lacks explicit mention of alternatives like batch operations but provides sufficient context for typical use.

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