get_campaign_details
Retrieve campaign-specific details such as ID, name, objective, and status from Meta Ads. Customize the fields parameter to include additional data like effective_status or source_campaign_id for deeper insights.
Instructions
Get detailed information about a specific campaign.
Note: This function requests a specific set of fields ('id,name,objective,status,...').
The Meta API offers many other fields for campaigns (e.g., 'effective_status', 'source_campaign_id', etc.)
that could be added to the 'fields' parameter in the code if needed.
Args:
access_token: Meta API access token (optional - will use cached token if not provided)
campaign_id: Meta Ads campaign ID
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| access_token | No | ||
| campaign_id | No |
Input Schema (JSON Schema)
{
"properties": {
"access_token": {
"default": null,
"title": "Access Token",
"type": "string"
},
"campaign_id": {
"default": null,
"title": "Campaign Id",
"type": "string"
}
},
"title": "get_campaign_detailsArguments",
"type": "object"
}
Implementation Reference
- meta_ads_mcp/core/campaigns.py:87-111 (handler)The core handler function for the 'get_campaign_details' tool, decorated with @mcp_server.tool() for MCP registration and @meta_api_tool for Meta API integration. It fetches detailed campaign data from the Meta Ads API endpoint using the provided campaign_id.@mcp_server.tool() @meta_api_tool async def get_campaign_details(campaign_id: str, access_token: Optional[str] = None) -> str: """ Get detailed information about a specific campaign. Note: This function requests a specific set of fields ('id,name,objective,status,...'). The Meta API offers many other fields for campaigns (e.g., 'effective_status', 'source_campaign_id', etc.) that could be added to the 'fields' parameter in the code if needed. Args: campaign_id: Meta Ads campaign ID access_token: Meta API access token (optional - will use cached token if not provided) """ if not campaign_id: return json.dumps({"error": "No campaign ID provided"}, indent=2) endpoint = f"{campaign_id}" params = { "fields": "id,name,objective,status,daily_budget,lifetime_budget,buying_type,start_time,stop_time,created_time,updated_time,bid_strategy,special_ad_categories,special_ad_category_country,budget_remaining,configured_status" } data = await make_api_request(endpoint, access_token, params) return json.dumps(data, indent=2)