Skip to main content
Glama
dhawalshah

meta-ads-mcp

get_ad_insights

Fetch performance data for a single Facebook ad: impressions, clicks, spend, conversions, engagement, and video metrics. Filter by date, breakdown, attribution, and sorting to diagnose campaign results.

Instructions

Retrieves detailed performance insights for a specific Facebook ad.

Fetches performance metrics for an individual ad (ad group), such as impressions, clicks, conversions, engagement, video views, etc. Allows for customization via time periods, breakdowns, filtering, sorting, and attribution settings. Note that some metrics may be estimated or in development.

Args: ad_id (str): The ID of the target ad (ad group), e.g., '6123456789012'. fields (Optional[List[str]]): A list of specific metrics and fields. Common examples: 'ad_name', 'adset_name', 'campaign_name', 'account_id', 'impressions', 'clicks', 'spend', 'ctr', 'cpc', 'cpm', 'cpp', 'reach', 'frequency', 'actions', 'conversions', 'cost_per_action_type', 'inline_link_clicks', 'inline_post_engagement', 'unique_clicks', 'video_p25_watched_actions', 'video_p50_watched_actions', 'video_p75_watched_actions', 'video_p95_watched_actions', 'video_p100_watched_actions', 'video_avg_time_watched_actions', 'website_ctr', 'website_purchases'. date_preset (str): A predefined relative time range ('last_30d', 'last_7d', etc.). Default: 'last_30d'. Ignored if 'time_range', 'time_ranges', 'since', or 'until' is used. time_range (Optional[Dict[str, str]]): Specific time range {'since':'YYYY-MM-DD','until':'YYYY-MM-DD'}. Overrides 'date_preset'. Ignored if 'time_ranges' is provided. time_ranges (Optional[List[Dict[str, str]]]): Array of time range objects for comparison. Overrides 'time_range' and 'date_preset'. time_increment (str | int): Granularity of the time breakdown ('all_days', 'monthly', 1-90 days). Default: 'all_days'. action_attribution_windows (Optional[List[str]]): Specifies attribution windows for actions. Examples: '1d_view', '7d_click'. Default depends on API/settings. action_breakdowns (Optional[List[str]]): Segments 'actions' results. Examples: 'action_device', 'action_type'. Default: ['action_type']. action_report_time (Optional[str]): Time basis for action stats ('impression', 'conversion', 'mixed'). Default: 'mixed'. breakdowns (Optional[List[str]]): Segments results by dimensions. Examples: 'age', 'gender', 'country', 'publisher_platform', 'impression_device', 'platform_position', 'device_platform'. default_summary (bool): If True, includes an additional summary row. Default: False. use_account_attribution_setting (bool): If True, uses the ad account's attribution settings. Default: False. use_unified_attribution_setting (bool): If True, uses unified attribution settings. Default: True. level (Optional[str]): Level of aggregation. Should typically be 'ad'. Default: 'ad'. filtering (Optional[List[dict]]): List of filter objects {'field': '...', 'operator': '...', 'value': '...'}. sort (Optional[str]): Field and direction for sorting ('{field}_ascending'/'_descending'). limit (Optional[int]): Maximum number of results per page. after (Optional[str]): Pagination cursor for the next page. before (Optional[str]): Pagination cursor for the previous page. offset (Optional[int]): Alternative pagination: skips N results. since (Optional[str]): Start timestamp for time-based pagination (if time ranges absent). until (Optional[str]): End timestamp for time-based pagination (if time ranges absent). locale (Optional[str]): The locale for text responses (e.g., 'en_US'). This controls language and formatting of text fields in the response.

Returns:
Dict: A dictionary containing the requested ad insights, with 'data' and 'paging' keys.

Example: ```python # Get basic ad performance for the last 30 days ad_insights = get_ad_insights( ad_id="6123456789012", fields=["ad_name", "impressions", "clicks", "spend", "ctr", "reach"], limit=10 )

# Get ad performance with platform breakdown for last 14 days
platform_insights = get_ad_insights(
    ad_id="6123456789012",
    fields=["ad_name", "impressions", "clicks", "spend"],
    breakdowns=["publisher_platform", "platform_position"],
    date_preset="last_14d"
)

# Fetch the next page of basic performance if available
next_page_url = ad_insights.get("paging", {}).get("next")
if next_page_url:
    next_page = fetch_pagination_url(url=next_page_url)
```

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sortNo
ad_idYes
afterNo
levelNo
limitNo
sinceNo
untilNo
beforeNo
fieldsNo
localeNo
offsetNo
filteringNo
breakdownsNo
time_rangeNo
date_presetNolast_30d
time_rangesNo
time_incrementNoall_days
default_summaryNo
action_breakdownsNo
action_report_timeNo
action_attribution_windowsNo
use_account_attribution_settingNo
use_unified_attribution_settingNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It goes beyond a simple retrieval statement by noting 'some metrics may be estimated or in development', documenting parameter precedence (e.g., 'Overrides date_preset', 'Ignored if time_ranges is provided'), and revealing default dependence on API/settings for attribution windows. It does not mention auth requirements, rate limits, or error conditions, but the behavioral traits it does cover are material and useful.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long, but the length is justified by the 23 parameters and zero schema coverage. It is front-loaded with a two-sentence summary before diving into Args, and the Returns and Example sections are functional. Every section earns its place; the only slight deduction is that the Args list could tighten a few repetitive default statements without losing value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 23-parameter tool with no annotations, the description is remarkably complete: it covers all parameters, return shape, example usage, pagination handling, and an important caveat about metric reliability. An agent has enough information to call the tool correctly and to chain pagination with the sibling fetch_pagination_url tool. The presence of an output schema also offsets the need to describe return values in more detail.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so the description must fully compensate. It does so exceptionally: every one of the 23 parameters is explained with type, default, examples, and precedence relationships. The fields parameter even lists many common metric strings. This adds substantial meaning beyond the bare schema and is the strongest aspect of the definition.

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 opens with a specific verb and resource: 'Retrieves detailed performance insights for a specific Facebook ad' and repeats 'individual ad (ad group)' in the second line. This clearly distinguishes it from sibling insight tools like get_campaign_insights, get_adset_insights, and get_adaccount_insights, which operate at different levels of aggregation. The tool's purpose is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use the tool: when performance metrics are needed for a single ad, not an account, campaign, or ad set. It does not explicitly name alternative tools or state when not to use this one, but the entity scope ('specific Facebook ad', 'individual ad') is clear enough for an agent to select it correctly among the sibling insight tools. There are no explicit exclusions, so it falls short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.