google_ads_list_bidding_strategies
Retrieve all portfolio bidding strategies in your Google Ads account with basic info using a customer ID.
Instructions
List all portfolio bidding strategies in the account.
Args: customer_id: Customer ID (without hyphens)
Returns: List of all portfolio bidding strategies with basic info
Example: google_ads_list_bidding_strategies( customer_id="1234567890" )
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customer_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The main handler function for the google_ads_list_bidding_strategies tool. It runs a GAQL query to fetch all portfolio bidding strategies from Google Ads, parses the response, logs the operation, and returns a formatted markdown list of strategies.
@mcp.tool() def google_ads_list_bidding_strategies( customer_id: str ) -> str: """ List all portfolio bidding strategies in the account. Args: customer_id: Customer ID (without hyphens) Returns: List of all portfolio bidding strategies with basic info Example: google_ads_list_bidding_strategies( customer_id="1234567890" ) """ with performance_logger.track_operation('list_bidding_strategies', customer_id=customer_id): try: client = get_auth_manager().get_client() ga_service = client.get_service("GoogleAdsService") query = """ 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 FROM bidding_strategy """ response = ga_service.search(customer_id=customer_id, query=query) strategies = [] for row in response: strategy = row.bidding_strategy strategies.append({ 'id': str(strategy.id), 'name': strategy.name, 'type': strategy.type.name, 'campaign_count': strategy.campaign_count }) # Audit log audit_logger.log_api_call( customer_id=customer_id, operation="list_bidding_strategies", resource_type="bidding_strategy", action="read", result="success", details={'strategy_count': len(strategies)} ) if not strategies: return "No portfolio bidding strategies found. Create one with `google_ads_create_bidding_strategy`." # Format response output = f"# Portfolio Bidding Strategies\n\n" output += f"**Total Strategies**: {len(strategies)}\n\n" for strategy in strategies: output += f"## {strategy['name']}\n" output += f"- **ID**: {strategy['id']}\n" output += f"- **Type**: {strategy['type']}\n" output += f"- **Campaigns Using**: {strategy['campaign_count']}\n\n" return output except Exception as e: error_msg = ErrorHandler.handle_error(e, context="list_bidding_strategies") return f"❌ Failed to list bidding strategies: {error_msg}" - tools/bidding/mcp_tools_bidding.py:42-43 (registration)The registration function that registers all bidding tools (including google_ads_list_bidding_strategies via @mcp.tool() decorator) with the MCP server.
def register_bidding_tools(mcp): """Register all bidding strategy management tools with the MCP server. - google_ads_mcp.py:480-495 (registration)The master tool registration table listing the bidding module path and registration function name, which causes register_bidding_tools to be called.
_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"), ] - google_ads_mcp.py:498-513 (registration)The function that dynamically imports and invokes each tool module's registration function, including register_bidding_tools for bidding.
def _register_all_modular_tools(): """Import and register every modular tool module.""" import importlib registered = 0 for label, module_path, func_name in _TOOL_MODULES: try: mod = importlib.import_module(module_path) register_fn = getattr(mod, func_name) register_fn(mcp) logger.info(f" ✓ {label}") registered += 1 except Exception as exc: logger.error(f" ✗ {label}: {exc}") logger.info(f"Registered {registered}/{len(_TOOL_MODULES)} modular tool modules") - The schema is defined inline via the function signature: customer_id (str) is the only parameter. The return type is str. The docstring provides the schema description.
@mcp.tool() def google_ads_list_bidding_strategies( customer_id: str ) -> str: