Skip to main content
Glama

search_interests

Find interest targeting options for Meta Ads campaigns by entering keywords to discover audience segments with relevant data for campaign optimization.

Instructions

Search for interest targeting options by keyword. Args: query: Search term for interests (e.g., "baseball", "cooking", "travel") access_token: Meta API access token (optional - will use cached token if not provided) limit: Maximum number of results to return (default: 25) Returns: JSON string containing interest data with id, name, audience_size, and path fields

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
access_tokenNo
limitNo

Implementation Reference

  • The primary handler function for the 'search_interests' MCP tool. It performs keyword searches against the Meta Ads API targeting search endpoint, returning JSON-formatted interest data including IDs, names, audience sizes, and hierarchy paths. Registered via @mcp_server.tool() decorator. Input schema defined by function parameters and typing annotations.
    @mcp_server.tool() @meta_api_tool async def search_interests(query: str, access_token: Optional[str] = None, limit: int = 25) -> str: """ Search for interest targeting options by keyword. Args: query: Search term for interests (e.g., "baseball", "cooking", "travel") access_token: Meta API access token (optional - will use cached token if not provided) limit: Maximum number of results to return (default: 25) Returns: JSON string containing interest data with id, name, audience_size, and path fields """ if not query: return json.dumps({"error": "No search query provided"}, indent=2) endpoint = "search" params = { "type": "adinterest", "q": query, "limit": limit } data = await make_api_request(endpoint, access_token, params) return json.dumps(data, indent=2)
  • Import statement in core/__init__.py that loads the targeting module, triggering the execution of decorators that register the search_interests tool with the MCP server.
    from .targeting import search_interests, get_interest_suggestions, estimate_audience_size, search_behaviors, search_demographics, search_geo_locations
  • Package-level export/import of search_interests function, making it available for use after registration.
    search_interests,

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