Skip to main content
Glama

search_interests

Identify relevant interest targeting options for Meta Ads campaigns by keyword search. Retrieve interest data including ID, name, audience size, and path in JSON format to optimize ad targeting strategies.

Instructions

Search for interest targeting options by keyword. Args: access_token: Meta API access token (optional - will use cached token if not provided) query: Search term for interests (e.g., "baseball", "cooking", "travel") 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
access_tokenNo
limitNo
queryNo

Implementation Reference

  • Core implementation of the search_interests MCP tool. This async function handles the API request to Meta's search endpoint for adinterests, with input validation, parameter construction, and JSON response formatting. Registered via @mcp_server.tool() decorator.
    @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)
  • Re-exports the search_interests function from targeting.py to make it available at the core module level, facilitating package-wide tool registration.
    from .targeting import search_interests, get_interest_suggestions, estimate_audience_size, search_behaviors, search_demographics, search_geo_locations

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