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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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,
Behavior2/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 mentions the optional 'access_token' parameter and caching behavior, which adds some context. However, it lacks details on rate limits, error handling, authentication requirements beyond the token, or whether this is a read-only operation (implied by 'search' but not explicit). For a tool with no annotations, this is insufficient behavioral disclosure.

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

Conciseness5/5

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

The description is well-structured and front-loaded with the core purpose, followed by clear sections for 'Args' and 'Returns'. Every sentence adds value: the first states the purpose, and the subsequent lines efficiently document parameters and return values without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, 1 required), no annotations, and an output schema (implied by 'Returns' section), the description is reasonably complete. It covers parameters and return format adequately. However, it could improve by addressing behavioral aspects like rate limits or error cases, which are missing despite the lack of annotations.

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?

The description adds significant value beyond the input schema, which has 0% description coverage. It explains each parameter's purpose: 'query' is for search terms with examples, 'access_token' is optional with caching behavior, and 'limit' specifies maximum results with a default. This compensates well for the schema's lack of descriptions, though it doesn't detail parameter constraints like format or ranges.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Search for interest targeting options by keyword.' It specifies the verb ('search'), resource ('interest targeting options'), and mechanism ('by keyword'). However, it doesn't explicitly differentiate from sibling tools like 'search_behaviors' or 'search_demographics' that also search targeting options but for different categories.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through the example keywords ('baseball', 'cooking', 'travel'), suggesting it's for finding interests in advertising targeting. However, it doesn't explicitly state when to use this tool versus alternatives like 'search_behaviors' or 'search_demographics', nor does it mention prerequisites or exclusions.

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

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