google_ads_get_bidding_strategy_details
Retrieve the complete configuration and settings of a portfolio bidding strategy to analyze or adjust its performance.
Instructions
Get full configuration details for a portfolio bidding strategy.
Args: customer_id: Customer ID (without hyphens) bidding_strategy_id: Bidding strategy ID
Returns: Complete strategy configuration and settings
Example: google_ads_get_bidding_strategy_details( customer_id="1234567890", bidding_strategy_id="12345" )
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customer_id | Yes | ||
| bidding_strategy_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The main handler function for the 'google_ads_get_bidding_strategy_details' tool. It accepts customer_id and bidding_strategy_id, queries the Google Ads API via GoogleAdsService, and formats the response with strategy configuration details (name, ID, type, campaign count, target CPA/ROAS/impression share, enhanced CPC).
@mcp.tool() def google_ads_get_bidding_strategy_details( customer_id: str, bidding_strategy_id: str ) -> str: """ Get full configuration details for a portfolio bidding strategy. Args: customer_id: Customer ID (without hyphens) bidding_strategy_id: Bidding strategy ID Returns: Complete strategy configuration and settings Example: google_ads_get_bidding_strategy_details( customer_id="1234567890", bidding_strategy_id="12345" ) """ with performance_logger.track_operation('get_bidding_strategy_details', customer_id=customer_id): try: client = get_auth_manager().get_client() ga_service = client.get_service("GoogleAdsService") query = f""" SELECT bidding_strategy.id, bidding_strategy.name, bidding_strategy.type, bidding_strategy.campaign_count, bidding_strategy.target_cpa.target_cpa_micros, bidding_strategy.target_roas.target_roas, bidding_strategy.target_impression_share.target_impression_share, bidding_strategy.target_impression_share.location, bidding_strategy.target_impression_share.cpc_bid_ceiling_micros, bidding_strategy.enhanced_cpc FROM bidding_strategy WHERE bidding_strategy.id = {bidding_strategy_id} """ response = ga_service.search(customer_id=customer_id, query=query) results = list(response) if not results: return f"❌ Bidding strategy {bidding_strategy_id} not found" row = results[0] strategy = row.bidding_strategy # Audit log audit_logger.log_api_call( customer_id=customer_id, operation="get_bidding_strategy_details", resource_type="bidding_strategy", resource_id=bidding_strategy_id, action="read", result="success" ) # Format response output = f"# Bidding Strategy Details\n\n" output += f"**Name**: {strategy.name}\n" output += f"**ID**: {strategy.id}\n" output += f"**Type**: {strategy.type.name}\n" output += f"**Campaigns Using**: {strategy.campaign_count}\n\n" output += f"## Configuration\n\n" if strategy.type.name == 'TARGET_CPA': output += f"**Target CPA**: ${strategy.target_cpa.target_cpa_micros / 1_000_000:.2f}\n" elif strategy.type.name == 'TARGET_ROAS': output += f"**Target ROAS**: {strategy.target_roas.target_roas:.2f}x ({strategy.target_roas.target_roas * 100:.0f}%)\n" elif strategy.type.name == 'TARGET_IMPRESSION_SHARE': output += f"**Target Impression Share**: {strategy.target_impression_share.target_impression_share * 100:.0f}%\n" output += f"**Location**: {strategy.target_impression_share.location.name}\n" if strategy.target_impression_share.cpc_bid_ceiling_micros: output += f"**Max CPC Bid**: ${strategy.target_impression_share.cpc_bid_ceiling_micros / 1_000_000:.2f}\n" elif strategy.type.name == 'MANUAL_CPC': output += f"**Enhanced CPC**: {'Enabled' if strategy.enhanced_cpc else 'Disabled'}\n" return output except Exception as e: error_msg = ErrorHandler.handle_error(e, context="get_bidding_strategy_details") return f"❌ Failed to get bidding strategy details: {error_msg}" - tools/bidding/mcp_tools_bidding.py:42-48 (registration)The registration function 'register_bidding_tools' that is called to register all bidding tools (including google_ads_get_bidding_strategy_details) with the MCP server via @mcp.tool() decorator.
def register_bidding_tools(mcp): """Register all bidding strategy management tools with the MCP server. Args: mcp: FastMCP server instance """ - google_ads_mcp.py:480-495 (registration)Top-level registration mapping that ties the 'bidding' module to 'tools.bidding.mcp_tools_bidding.register_bidding_tools', which is dynamically imported and invoked during MCP server startup.
_TOOL_MODULES = [ ("campaigns", "tools.campaigns.mcp_tools_campaigns", "register_campaign_tools"), ("ad_groups", "tools.ad_groups.mcp_tools_ad_groups", "register_ad_group_tools"), ("keywords", "tools.keywords.mcp_tools_keywords", "register_keyword_tools"), ("ads", "tools.ads.mcp_tools_ads", "register_ad_tools"), ("bidding", "tools.bidding.mcp_tools_bidding", "register_bidding_tools"), ("automation", "tools.automation.mcp_tools_automation", "register_automation_tools"), ("audiences", "tools.audiences.mcp_tools_audiences", "register_audience_tools"), ("conversions", "tools.conversions.mcp_tools_conversions", "register_conversion_tools"), ("reporting", "tools.reporting.mcp_tools_reporting", "register_reporting_tools"), ("insights", "tools.insights.mcp_tools_insights", "register_insights_tools"), ("batch", "tools.batch.mcp_tools_batch", "register_batch_tools"), ("shopping_pmax", "tools.shopping_pmax.mcp_tools_shopping_pmax", "register_shopping_pmax_tools"), ("extensions", "tools.extensions.mcp_tools_extensions", "register_extension_tools"), ("local_app", "tools.local_app.mcp_tools_local_app", "register_local_app_tools"), ] - The function signature serves as the schema/type definition for the tool's inputs: customer_id (str) and bidding_strategy_id (str), with return type str.
def google_ads_get_bidding_strategy_details( customer_id: str, bidding_strategy_id: str ) -> str: """ Get full configuration details for a portfolio bidding strategy. Args: customer_id: Customer ID (without hyphens) bidding_strategy_id: Bidding strategy ID Returns: Complete strategy configuration and settings Example: google_ads_get_bidding_strategy_details( customer_id="1234567890", bidding_strategy_id="12345" ) """ - Supporting imports and utilities used by the handler: BiddingStrategyManager, ErrorHandler, performance_logger, audit_logger, auth_manager, and cache_manager.
from typing import Optional, List, Dict, Any from managers.bidding_strategy_manager import ( BiddingStrategyManager, BiddingStrategyConfig, BiddingStrategyType, ImpressionShareLocation,