google_ads_add_call_extension
Add a call extension to a Google Ads campaign to display your phone number with a click-to-call button, enabling mobile users to contact you directly from the ad.
Instructions
Add call extension to a campaign.
Call extensions display your phone number with a click-to-call button, making it easy for mobile users to contact you directly from the ad.
Args: customer_id: Google Ads customer ID (10 digits, no hyphens) campaign_id: Campaign ID to add call extension phone_number: Phone number in local format (e.g., "(555) 123-4567") country_code: Two-letter country code (default: US) track_calls: Enable call conversion tracking
Returns: Call extension creation result
Example: google_ads_add_call_extension( customer_id="1234567890", campaign_id="12345678", phone_number="(555) 123-4567", country_code="US", track_calls=True )
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customer_id | Yes | ||
| campaign_id | Yes | ||
| phone_number | Yes | ||
| country_code | No | US | |
| track_calls | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The MCP tool handler function 'google_ads_add_call_extension' that receives the tool call, validates inputs, creates a CallExtensionConfig, calls the manager, and returns a formatted result string.
def google_ads_add_call_extension( customer_id: str, campaign_id: str, phone_number: str, country_code: str = "US", track_calls: bool = False ) -> str: """Add call extension to a campaign. Call extensions display your phone number with a click-to-call button, making it easy for mobile users to contact you directly from the ad. Args: customer_id: Google Ads customer ID (10 digits, no hyphens) campaign_id: Campaign ID to add call extension phone_number: Phone number in local format (e.g., "(555) 123-4567") country_code: Two-letter country code (default: US) track_calls: Enable call conversion tracking Returns: Call extension creation result Example: google_ads_add_call_extension( customer_id="1234567890", campaign_id="12345678", phone_number="(555) 123-4567", country_code="US", track_calls=True ) """ with performance_logger.track_operation('add_call_extension', customer_id=customer_id): try: client = get_auth_manager().get_client() extensions_manager = ExtensionsManager(client) config = CallExtensionConfig( phone_number=phone_number, country_code=country_code, call_conversion_reporting_state=( CallConversionReportingState.USE_ACCOUNT_LEVEL_CALL_CONVERSION_ACTION if track_calls else CallConversionReportingState.DISABLED ) ) result = extensions_manager.add_call_extension( customer_id=customer_id, campaign_id=campaign_id, config=config ) audit_logger.log_api_call( customer_id=customer_id, operation='add_call_extension', campaign_id=campaign_id, status='success' ) output = f"# 📞 Call Extension Added\n\n" output += f"**Campaign ID**: {result['campaign_id']}\n" output += f"**Phone Number**: {result['phone_number']}\n" output += f"**Country Code**: {result['country_code']}\n" output += f"**Call Tracking**: {'Enabled' if track_calls else 'Disabled'}\n\n" output += "## What Are Call Extensions?\n\n" output += "Call extensions add a phone number to your ads with a clickable\n" output += "call button on mobile devices. Users can call you directly from\n" output += "search results without visiting your website.\n\n" output += "## Benefits\n\n" output += "✅ **Mobile Optimization** - One-tap calling on smartphones\n" output += "✅ **Higher Conversion Rates** - Direct contact = faster sales\n" output += "✅ **Call Tracking** - Measure calls as conversions\n" output += "✅ **Local Businesses** - Essential for location-based services\n\n" if track_calls: output += "📊 **Call Tracking Enabled**: Calls will be tracked as conversions\n\n" output += "💡 **Best Practices**:\n" output += "- Set business hours scheduling\n" output += "- Use a dedicated tracking number\n" output += "- Enable call reporting to measure ROI\n" output += "- Ensure staff is ready to handle calls\n" return output except Exception as e: error_msg = ErrorHandler.handle_error(e, context="add_call_extension") return f"❌ Failed to add call extension: {error_msg}" - tools/extensions/mcp_tools_extensions.py:34-34 (registration)The 'register_extension_tools(mcp)' function that registers the tool decorator (@mcp.tool()) on the handler function.
def register_extension_tools(mcp): - managers/extensions_manager.py:60-65 (schema)The CallExtensionConfig dataclass defining the schema for call extension configuration (phone_number, country_code, call_conversion_reporting_state).
@dataclass class CallExtensionConfig: """Configuration for call extension.""" phone_number: str country_code: str = "US" call_conversion_reporting_state: CallConversionReportingState = CallConversionReportingState.DISABLED - managers/extensions_manager.py:38-42 (schema)The CallConversionReportingState enum defining possible call conversion reporting states (DISABLED, USE_ACCOUNT_LEVEL_CALL_CONVERSION_ACTION, USE_RESOURCE_LEVEL_CALL_CONVERSION_ACTION).
class CallConversionReportingState(str, Enum): """Call conversion reporting states.""" DISABLED = "DISABLED" USE_ACCOUNT_LEVEL_CALL_CONVERSION_ACTION = "USE_ACCOUNT_LEVEL_CALL_CONVERSION_ACTION" USE_RESOURCE_LEVEL_CALL_CONVERSION_ACTION = "USE_RESOURCE_LEVEL_CALL_CONVERSION_ACTION" - The ExtensionsManager.add_call_extension() method that performs the actual Google Ads API calls to create the call asset and link it to the campaign.
def add_call_extension( self, customer_id: str, campaign_id: str, config: CallExtensionConfig ) -> Dict[str, Any]: """Add call extension to a campaign. Args: customer_id: Customer ID (without hyphens) campaign_id: Campaign ID config: Call extension configuration Returns: Created call extension details """ asset_service = self.client.get_service("AssetService") campaign_asset_service = self.client.get_service("CampaignAssetService") # Create call asset asset_operation = self.client.get_type("AssetOperation") asset = asset_operation.create asset.type_ = self.client.enums.AssetTypeEnum.CALL asset.call_asset.phone_number = config.phone_number asset.call_asset.country_code = config.country_code asset.call_asset.call_conversion_reporting_state = ( self.client.enums.CallConversionReportingStateEnum[config.call_conversion_reporting_state.value] ) # Create asset asset_response = asset_service.mutate_assets( customer_id=customer_id, operations=[asset_operation] ) asset_resource_name = asset_response.results[0].resource_name # Link asset to campaign campaign_asset_operation = self.client.get_type("CampaignAssetOperation") campaign_asset = campaign_asset_operation.create campaign_asset.asset = asset_resource_name campaign_asset.campaign = self.client.get_service("CampaignService").campaign_path( customer_id, campaign_id ) campaign_asset.field_type = self.client.enums.AssetFieldTypeEnum.CALL campaign_asset_service.mutate_campaign_assets( customer_id=customer_id, operations=[campaign_asset_operation] ) return { 'campaign_id': campaign_id, 'phone_number': config.phone_number, 'country_code': config.country_code, 'asset_resource_name': asset_resource_name }