Skip to main content
Glama
johnoconnor0

Google Ads MCP Server

by johnoconnor0

google_ads_update_keyword_status

Update keyword status in Google Ads campaigns by enabling, pausing, or removing keywords with specified criteria.

Instructions

Update keyword status (enable, pause, or remove).

Args: customer_id: Customer ID (without hyphens) ad_group_id: Ad group ID criterion_id: Keyword criterion ID status: New status (ENABLED, PAUSED, or REMOVED)

Returns: Success message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customer_idYes
ad_group_idYes
criterion_idYes
statusYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler that updates keyword status (enable, pause, or remove). Calls KeywordManager.update_keyword_status.
    def google_ads_update_keyword_status(
        customer_id: str,
        ad_group_id: str,
        criterion_id: str,
        status: str
    ) -> str:
        """
        Update keyword status (enable, pause, or remove).
    
        Args:
            customer_id: Customer ID (without hyphens)
            ad_group_id: Ad group ID
            criterion_id: Keyword criterion ID
            status: New status (ENABLED, PAUSED, or REMOVED)
    
        Returns:
            Success message
        """
        with performance_logger.track_operation('update_keyword_status', customer_id=customer_id):
            try:
                client = get_auth_manager().get_client()
                keyword_manager = KeywordManager(client)
    
                status_upper = status.upper()
                result = keyword_manager.update_keyword_status(
                    customer_id,
                    ad_group_id,
                    criterion_id,
                    KeywordStatus[status_upper]
                )
    
                # Audit log
                audit_logger.log_api_call(
                    customer_id=customer_id,
                    operation="update_keyword_status",
                    resource_type="keyword",
                    resource_id=criterion_id,
                    action="update",
                    result="success",
                    details={'new_status': status_upper}
                )
    
                # Invalidate cache
                get_cache_manager().invalidate(customer_id, ResourceType.KEYWORD)
    
                status_messages = {
                    "ENABLED": "Keyword is now active and will trigger ads.",
                    "PAUSED": "Keyword is now paused and will not trigger ads.",
                    "REMOVED": "Keyword has been removed."
                }
    
                return (
                    f"✅ Keyword status updated to {status_upper}\n\n"
                    f"**Criterion ID**: {criterion_id}\n\n"
                    f"{status_messages.get(status_upper, 'Status updated successfully.')}"
                )
    
            except Exception as e:
                error_msg = ErrorHandler.handle_error(e, context="update_keyword_status")
                return f"❌ Failed to update keyword status: {error_msg}"
  • Enum defining valid keyword statuses: ENABLED, PAUSED, REMOVED
    class KeywordStatus(str, Enum):
        """Keyword status options."""
        ENABLED = "ENABLED"
        PAUSED = "PAUSED"
        REMOVED = "REMOVED"
  • KeywordManager method that builds the AdGroupCriterionOperation, sets field mask for status, calls mutate_ad_group_criteria to update the keyword status in Google Ads.
    def update_keyword_status(
        self,
        customer_id: str,
        ad_group_id: str,
        criterion_id: str,
        status: KeywordStatus
    ) -> Dict[str, Any]:
        """
        Update keyword status.
    
        Args:
            customer_id: Customer ID
            ad_group_id: Ad group ID
            criterion_id: Keyword criterion ID
            status: New status
    
        Returns:
            Operation result
        """
        ad_group_criterion_service = self.client.get_service("AdGroupCriterionService")
    
        operation = self.client.get_type("AdGroupCriterionOperation")
        criterion = operation.update
    
        criterion.resource_name = ad_group_criterion_service.ad_group_criterion_path(
            customer_id, ad_group_id, criterion_id
        )
        criterion.status = self.client.enums.AdGroupCriterionStatusEnum[status.value]
    
        # Set field mask
        self.client.copy_from(
            operation.update_mask,
            field_mask_pb2.FieldMask(paths=["status"])
        )
    
        # Update keyword
        response = ad_group_criterion_service.mutate_ad_group_criteria(
            customer_id=customer_id,
            operations=[operation]
        )
    
        logger.info(f"Updated keyword {criterion_id} status to {status.value}")
    
        return {
            "criterion_id": criterion_id,
            "new_status": status.value,
            "message": f"Keyword status updated to {status.value}"
        }
  • Registration function decorated with @mcp.tool() that registers google_ads_update_keyword_status as an MCP tool. Called from google_ads_mcp.py via _TOOL_MODULES registration.
    def register_keyword_tools(mcp: FastMCP):
        """Register keyword management tools with MCP server."""
  • Top-level registration entry in _TOOL_MODULES list that wires the keyword tools module into the MCP server.
    ("keywords",      "tools.keywords.mcp_tools_keywords",           "register_keyword_tools"),
Behavior2/5

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

Minimal behavioral disclosure beyond the action; no mention of permissions, reversibility, or side effects. Annotations are absent, so the description carries the full burden but fails to provide 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?

Highly concise with structured Args/Returns format. Every sentence is essential with no redundancy.

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?

Adequately describes the function and parameters but lacks guidance on when to use this tool over sibling tools, especially batch/bulk variants. Output schema exists but description's return mention is vague.

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

Parameters3/5

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

Schema description coverage is 0%, but the description adds parameter details: customer_id format, available status enum values. However, it does not explain ad_group_id and criterion_id sufficiently for easy lookup.

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 action (update) and resource (keyword status) with explicit possible statuses (enable, pause, remove). It is distinct from sibling tools like bulk or bid 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 on when to use this tool versus alternatives like batch or bulk update tools. It does not specify exclusions or prerequisites.

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