Skip to main content
Glama

get_adset_details

Retrieve comprehensive data about a Meta Ads ad set, including performance metrics and configuration details, to analyze campaign effectiveness and optimize advertising strategies.

Instructions

Get detailed information about a specific ad set.

Args:
    adset_id: Meta Ads ad set ID
    access_token: Meta API access token (optional - will use cached token if not provided)

Example:
    To call this function through MCP, pass the adset_id as the first argument:
    {
        "args": "YOUR_ADSET_ID"
    }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
adset_idYes
access_tokenNo

Implementation Reference

  • The handler function implementing the get_adset_details MCP tool. It is decorated with @mcp_server.tool() for registration and @meta_api_tool. Fetches detailed ad set information from the Meta Ads API using make_api_request, including special handling for frequency_control_specs and dsa_beneficiary fields.
    @mcp_server.tool()
    @meta_api_tool
    async def get_adset_details(adset_id: str, access_token: Optional[str] = None) -> str:
        """
        Get detailed information about a specific ad set.
        
        Args:
            adset_id: Meta Ads ad set ID
            access_token: Meta API access token (optional - will use cached token if not provided)
        
        Example:
            To call this function through MCP, pass the adset_id as the first argument:
            {
                "args": "YOUR_ADSET_ID"
            }
        """
        if not adset_id:
            return json.dumps({"error": "No ad set ID provided"}, indent=2)
        
        endpoint = f"{adset_id}"
        # Explicitly prioritize frequency_control_specs in the fields request
        params = {
            "fields": "id,name,campaign_id,status,frequency_control_specs{event,interval_days,max_frequency},daily_budget,lifetime_budget,targeting,bid_amount,bid_strategy,optimization_goal,billing_event,start_time,end_time,created_time,updated_time,attribution_spec,destination_type,promoted_object,pacing_type,budget_remaining,dsa_beneficiary,is_dynamic_creative"
        }
        
        data = await make_api_request(endpoint, access_token, params)
        
        # For debugging - check if frequency_control_specs was returned
        if 'frequency_control_specs' not in data:
            data['_meta'] = {
                'note': 'No frequency_control_specs field was returned by the API. This means either no frequency caps are set or the API did not include this field in the response.'
            }
        
        return json.dumps(data, indent=2)

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