Skip to main content
Glama
johnoconnor0

Google Ads MCP Server

by johnoconnor0

google_ads_list_user_lists

List all user lists (audiences) from a Google Ads account. Filter by type like CRM-based or rule-based for targeted audience analysis.

Instructions

List all user lists (audiences) in the account.

Args: customer_id: Customer ID (without hyphens) list_type: Optional filter by type (CRMBASED, RULE_BASED, SIMILAR, LOGICAL)

Returns: List of all user lists with details

Example: google_ads_list_user_lists( customer_id="1234567890", list_type="CRMBASED" )

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customer_idYes
list_typeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler function 'google_ads_list_user_lists' - decorated with @mcp.tool(), it takes customer_id and optional list_type, validates the list_type against UserListType enum, calls audience_manager.list_user_lists(), formats the results as a Markdown string with user list details (ID, type, description, sizes, match rate, duration, status), and handles errors.
    @mcp.tool()
    def google_ads_list_user_lists(
        customer_id: str,
        list_type: Optional[str] = None
    ) -> str:
        """
        List all user lists (audiences) in the account.
    
        Args:
            customer_id: Customer ID (without hyphens)
            list_type: Optional filter by type (CRMBASED, RULE_BASED, SIMILAR, LOGICAL)
    
        Returns:
            List of all user lists with details
    
        Example:
            google_ads_list_user_lists(
                customer_id="1234567890",
                list_type="CRMBASED"
            )
        """
        with performance_logger.track_operation('list_user_lists', customer_id=customer_id):
            try:
                client = get_auth_manager().get_client()
                audience_manager = AudienceManager(client)
    
                # Validate list type if provided
                ul_type = None
                if list_type:
                    try:
                        ul_type = UserListType[list_type.upper()]
                    except KeyError:
                        valid_types = [t.value for t in UserListType]
                        return f"❌ Invalid list type. Valid types: {', '.join(valid_types)}"
    
                user_lists = audience_manager.list_user_lists(customer_id, ul_type)
    
                # Audit log
                audit_logger.log_api_call(
                    customer_id=customer_id,
                    operation="list_user_lists",
                    resource_type="user_list",
                    action="read",
                    result="success",
                    details={'count': len(user_lists)}
                )
    
                if not user_lists:
                    return "No user lists found. Create one with `google_ads_create_user_list`."
    
                # Format response
                output = f"# User Lists (Audiences)\n\n"
                output += f"**Total Lists**: {len(user_lists)}\n\n"
    
                for ul in user_lists:
                    output += f"## {ul['name']}\n\n"
                    output += f"- **ID**: {ul['id']}\n"
                    output += f"- **Type**: {ul['type']}\n"
                    if ul['description']:
                        output += f"- **Description**: {ul['description']}\n"
                    output += f"- **Search Network Size**: {ul['size_for_search']:,}\n"
                    output += f"- **Display Network Size**: {ul['size_for_display']:,}\n"
                    if ul['match_rate_percentage']:
                        output += f"- **Match Rate**: {ul['match_rate_percentage']:.1f}%\n"
                    output += f"- **Membership Duration**: {ul['membership_life_span']} days\n"
                    output += f"- **Status**: {ul['membership_status']}\n\n"
    
                return output
    
            except Exception as e:
                error_msg = ErrorHandler.handle_error(e, context="list_user_lists")
                return f"❌ Failed to list user lists: {error_msg}"
  • The AudienceManager.list_user_lists() method that executes the Google Ads API query to fetch user lists. It builds a GAQL query selecting user_list fields (id, name, description, type, sizes, match rate, membership life span, status), optionally filtered by list_type, and returns a list of dictionaries.
    def list_user_lists(
        self,
        customer_id: str,
        list_type: Optional[UserListType] = None
    ) -> List[Dict[str, Any]]:
        """List all user lists (audiences) in the account.
    
        Args:
            customer_id: Customer ID (without hyphens)
            list_type: Optional filter by list type
    
        Returns:
            List of user lists with details
        """
        ga_service = self.client.get_service("GoogleAdsService")
    
        query = """
            SELECT
                user_list.id,
                user_list.name,
                user_list.description,
                user_list.type,
                user_list.size_for_display,
                user_list.size_for_search,
                user_list.match_rate_percentage,
                user_list.membership_life_span,
                user_list.membership_status
            FROM user_list
        """
    
        if list_type:
            query += f" WHERE user_list.type = '{list_type.value}'"
    
        response = ga_service.search(customer_id=customer_id, query=query)
    
        user_lists = []
        for row in response:
            ul = row.user_list
            user_lists.append({
                'id': str(ul.id),
                'name': ul.name,
                'description': ul.description,
                'type': ul.type.name,
                'size_for_display': ul.size_for_display,
                'size_for_search': ul.size_for_search,
                'match_rate_percentage': ul.match_rate_percentage,
                'membership_life_span': ul.membership_life_span,
                'membership_status': ul.membership_status.name
            })
    
        return user_lists
  • The UserListType enum defining valid user list types: CRMBASED, RULE_BASED, LOGICAL, SIMILAR. Used for input validation in the handler.
    class UserListType(str, Enum):
        """User list types for remarketing."""
        CRMBASED = "CRMBASED"  # Customer Match
        RULE_BASED = "RULE_BASED"  # Website/app visitors
        LOGICAL = "LOGICAL"  # Combination of other lists
        SIMILAR = "SIMILAR"  # Lookalike audiences
  • The registration function 'register_audience_tools(mcp)' which contains all the @mcp.tool() decorated tool definitions including google_ads_list_user_lists.
    def register_audience_tools(mcp):
        """Register all audience management tools with the MCP server.
    
        Args:
            mcp: FastMCP server instance
        """
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It describes a read-like operation (listing) without side effects, but does not disclose potential pagination, rate limits, or performance implications. The example adds some clarity but transparency is moderate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is relatively concise with separate sections for description, args, and example. The example is helpful. However, it could be slightly more compact without losing clarity.

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?

Despite explaining parameters and providing an example, the description does not specify what 'details' are returned, nor does it mention default behavior when list_type is null. Output schema exists but is not shown. There is no guidance on usage limits or prerequisites.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must add value. It explains customer_id format ('without hyphens') and provides explicit filter values (CRMBASED, RULE_BASED, SIMILAR, LOGICAL) that are missing from the schema. This compensates well for low coverage.

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 lists all user lists (audiences) in the account. It uses a specific verb and resource, distinguishing it from siblings like 'google_ads_create_user_list' or 'google_ads_get_user_list_details'.

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 'google_ads_search_google_audiences'. It does not mention exclusions or prerequisites. The description only states what it does, not when to use it.

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