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
| Name | Required | Description | Default |
|---|---|---|---|
| access_token | No | ||
| limit | No | ||
| query | No |
Implementation Reference
- meta_ads_mcp/core/targeting.py:10-36 (handler)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)
- meta_ads_mcp/core/__init__.py:14-14 (registration)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