get_adset_details
Retrieve comprehensive details for a specific Meta Ads ad set by providing its ID. Use this tool to access essential data for analyzing and optimizing advertising campaigns on Facebook and Instagram.
Instructions
Get detailed information about a specific ad set.
Args:
adset_id: Meta Ads ad set ID (required)
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
| Name | Required | Description | Default |
|---|---|---|---|
| access_token | No | ||
| adset_id | No |
Input Schema (JSON Schema)
{
"properties": {
"access_token": {
"default": null,
"title": "Access Token",
"type": "string"
},
"adset_id": {
"default": null,
"title": "Adset Id",
"type": "string"
}
},
"title": "get_adset_detailsArguments",
"type": "object"
}
Implementation Reference
- meta_ads_mcp/core/adsets.py:48-81 (handler)The primary handler function for the 'get_adset_details' tool. It fetches detailed ad set information from the Meta Ads API endpoint, including fields like frequency caps, budgets, targeting, and DSA beneficiary. Decorated with @mcp_server.tool() for MCP registration and @meta_api_tool for API handling.@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)
- meta_ads_mcp/core/__init__.py:6-6 (registration)Import statement in core/__init__.py that exposes get_adset_details at the core package level, making it available for further imports.from .adsets import get_adsets, get_adset_details, update_adset
- meta_ads_mcp/__init__.py:45-45 (registration)Package-level import and __all__ listing of get_adset_details in meta_ads_mcp/__init__.py, exporting the tool for package users.get_adset_details,