Skip to content

Commit e69a4e5

Browse files
committed
docs: update get_insights docstring to clarify response size and usage of bulk_get_insights
Added notes on the fixed set of fields returned by get_insights and provided guidance on using bulk_get_insights for specific metrics to manage response size effectively.
1 parent 82f1b67 commit e69a4e5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

meta_ads_mcp/core/insights.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ async def get_insights(object_id: str, access_token: Optional[str] = None,
9494
(omni_*, onsite_web_*, offsite_conversion.fb_pixel_*, etc.) to reduce
9595
payload size by ~60%. The canonical action types (purchase, add_to_cart,
9696
view_content, etc.) are always preserved. Default: False.
97+
98+
Note on response size: This tool always returns a fixed set of fields (impressions, clicks,
99+
spend, cpc, cpm, ctr, reach, actions, action_values, etc.) and cannot filter to a subset.
100+
For large result sets (50+ rows), the actions/action_values arrays can make responses very
101+
large (1–2MB+). If you only need specific metrics like spend or impressions, consider using
102+
bulk_get_insights with compact=true and the fields parameter:
103+
bulk_get_insights(level="ad", account_ids=[...], compact=true, fields=["spend", "impressions"])
104+
bulk_get_insights supports level="ad", "adset", "campaign", and "account".
97105
"""
98106
if not object_id:
99107
return json.dumps({"error": "No object ID provided"}, indent=2)

0 commit comments

Comments
 (0)