Skip to main content
Glama

search_behaviors

Retrieve behavior targeting options for Meta ads campaigns. Specify access token and limit to get JSON results with id, name, and audience size.

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler implementation of the search_behaviors tool. It queries the Meta Ads API 'search' endpoint with type='adTargetingCategory' and class='behaviors' to retrieve behavior targeting options. Returns JSON with id, name, audience_size bounds, path, and description.
    @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)
  • The tool is registered via the @mcp_server.tool() decorator on the search_behaviors async function, which makes it available as an MCP tool.
    @mcp_server.tool()
    @meta_api_tool
  • Re-export of search_behaviors at the package level, making it accessible from meta_ads_mcp.search_behaviors.
    search_behaviors,
  • Core package __init__ includes search_behaviors in __all__ and re-exports it for public API access.
    'search_behaviors',
  • Imports used by search_behaviors: json for serialization, Optional from typing, meta_api_tool decorator and make_api_request from .api, and mcp_server from .server for the @mcp_server.tool() decorator.
    """Targeting search functionality for Meta Ads API."""
    
    import json
    from typing import Optional, List, Dict, Any, Union
    import os
    from .api import meta_api_tool, make_api_request
    from .server import mcp_server
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the burden. It indicates a read operation ('Get') and mentions optional access_token with caching behavior. However, it does not disclose rate limits, pagination details, or any potential side effects.

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 extremely concise: a single line for purpose, followed by clear parameter documentation and a returns section. Every sentence is necessary and efficient.

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?

The tool has an output schema, so return value explanation is not needed. The description covers params and basic behavior. However, it lacks guidance on usage relative to sibling tools, making it slightly incomplete in context.

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?

With 0% schema description coverage, the description adds value by explaining the access_token parameter's caching behavior and the limit parameter's role as 'maximum number of results.' This goes beyond the schema's type/default information.

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

Purpose5/5

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

The description clearly states 'Get all available behavior targeting options,' using a specific verb and resource. It distinguishes this tool from siblings like search_interests or search_demographics by targeting a unique resource type.

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 for fetching behavior targeting options but provides no explicit guidance on when to use this tool versus alternatives (e.g., search_interests) or when not to use it. No exclusions or context for selection.

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