Skip to main content
Glama

get_campaign_details

Retrieve comprehensive campaign data including ID, name, objective, and status from Meta Ads platforms to analyze advertising performance and inform strategic decisions.

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: campaign_id: Meta Ads campaign ID access_token: Meta API access token (optional - will use cached token if not provided)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYes
access_tokenNo

Implementation Reference

  • The primary handler function for the 'get_campaign_details' tool. Decorated with @mcp_server.tool() for MCP registration and @meta_api_tool for Meta Ads API integration. Fetches detailed campaign information using the Meta Ads API endpoint.
    @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)
  • Imports the 'campaigns' module during server startup for Streamable HTTP transport, triggering the @mcp_server.tool() decorators to register the get_campaign_details tool among others.
    logger.info("Ensuring all tools are registered for HTTP transport") from . import accounts, campaigns, adsets, ads, insights, authentication from . import ads_library, budget_schedules, reports, openai_deep_research
  • Explicit import of the get_campaign_details function from campaigns.py into the core module, exposing it for use and further re-export.
    from .campaigns import get_campaigns, get_campaign_details, create_campaign
  • Docstring providing input schema (parameters with descriptions) and notes on API fields for the get_campaign_details tool, used by MCP for tool schema generation.
    """ 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) """

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