Skip to main content
Glama

search_behaviors

Retrieve behavior targeting options for Meta Ads campaigns to identify audience segments based on interests, activities, and purchase behaviors.

Instructions

Get all available behavior targeting options.

Args:
    access_token: Meta API access token (optional - will use cached token if not provided)
    limit: Maximum number of results to return (default: 50)

Returns:
    JSON string containing behavior targeting options with id, name, audience_size bounds, path, and description

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
access_tokenNo
limitNo

Implementation Reference

  • The primary handler function for the 'search_behaviors' tool. Decorated with @mcp_server.tool() for MCP registration and @meta_api_tool for API handling. Makes a request to the Meta Ads 'search' endpoint with parameters for adTargetingCategory of class 'behaviors', returning JSON results.
    @mcp_server.tool()
    @meta_api_tool
    async def search_behaviors(access_token: Optional[str] = None, limit: int = 50) -> str:
        """
        Get all available behavior targeting options.
        
        Args:
            access_token: Meta API access token (optional - will use cached token if not provided)
            limit: Maximum number of results to return (default: 50)
        
        Returns:
            JSON string containing behavior targeting options with id, name, audience_size bounds, path, and description
        """
        endpoint = "search"
        params = {
            "type": "adTargetingCategory",
            "class": "behaviors",
            "limit": limit
        }
        
        data = await make_api_request(endpoint, access_token, params)
        
        return json.dumps(data, indent=2)

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/pipeboard-co/meta-ads-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server