Skip to main content
Glama
dhawalshah

meta-ads-mcp

get_activities_by_adaccount

Track Facebook ad account changes by retrieving activity logs. Identify who modified budgets, campaigns, targeting, and audiences, with timestamps and details.

Instructions

Retrieves activities for a Facebook ad account.

This function accesses the Facebook Graph API to retrieve information about key updates to an ad account and ad objects associated with it. By default, this API returns one week's data. Information returned includes major account status changes, updates made to budget, campaign, targeting, audiences and more.

Args: act_id (str): The ID of the ad account, prefixed with 'act_', e.g., 'act_1234567890'. fields (Optional[List[str]]): A list of specific fields to retrieve. If None, all available fields will be returned. Available fields include: - 'actor_id': ID of the user who made the change - 'actor_name': Name of the user who made the change - 'application_id': ID of the application used to make the change - 'application_name': Name of the application used to make the change - 'changed_data': Details about what was changed in JSON format - 'date_time_in_timezone': The timestamp in the account's timezone - 'event_time': The timestamp of when the event occurred - 'event_type': The specific type of change that was made (numeric code) - 'extra_data': Additional data related to the change in JSON format - 'object_id': ID of the object that was changed (ad, campaign, etc.) - 'object_name': Name of the object that was changed - 'object_type': Type of object being modified, values include: 'AD', 'ADSET', 'CAMPAIGN', 'ACCOUNT', 'IMAGE', 'REPORT', etc. - 'translated_event_type': Human-readable description of the change made, examples include: 'ad created', 'campaign budget updated', 'targeting updated', 'ad status changed', etc. limit (Optional[int]): Maximum number of activities to return per page. Default behavior returns a server-determined number of results. after (Optional[str]): Pagination cursor for the next page of results. Obtained from the 'paging.cursors.after' field in the previous response. before (Optional[str]): Pagination cursor for the previous page of results. Obtained from the 'paging.cursors.before' field in the previous response. time_range (Optional[Dict[str, str]]): A custom time range with 'since' and 'until' dates in 'YYYY-MM-DD' format. Example: {'since': '2023-01-01', 'until': '2023-01-31'} This parameter overrides the since/until parameters if both are provided. since (Optional[str]): Start date in YYYY-MM-DD format. Defines the beginning of the time range for returned activities. Ignored if 'time_range' is provided. until (Optional[str]): End date in YYYY-MM-DD format. Defines the end of the time range for returned activities. Ignored if 'time_range' is provided.

Returns: Dict: A dictionary containing the requested activities. The main results are in the 'data' list, and pagination info is in the 'paging' object. Each activity object contains information about who made the change, what was changed, when it occurred, and the specific details of the change.

Example: ```python # Get recent activities for an ad account with default one week of data activities = get_activities_by_adaccount( act_id="act_123456789", fields=["event_time", "actor_name", "object_type", "translated_event_type"] )

# Get all activities from a specific date range
dated_activities = get_activities_by_adaccount(
    act_id="act_123456789",
    time_range={"since": "2023-01-01", "until": "2023-01-31"},
    fields=["event_time", "actor_name", "object_type", "translated_event_type", "extra_data"]
)

# Paginate through activity results
paginated_activities = get_activities_by_adaccount(
    act_id="act_123456789",
    limit=50,
    fields=["event_time", "actor_name", "object_type", "translated_event_type"]
)

# Get the next page using the cursor from the previous response
next_page_cursor = paginated_activities.get("paging", {}).get("cursors", {}).get("after")
if next_page_cursor:
    next_page = get_activities_by_adaccount(
        act_id="act_123456789",
        fields=["event_time", "actor_name", "object_type", "translated_event_type"],
        after=next_page_cursor
    )
```

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterNo
limitNo
sinceNo
untilNo
act_idYes
beforeNo
fieldsNo
time_rangeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/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 behavioral disclosure burden. It goes beyond a simple read statement by noting the default one-week return window, the precedence of time_range over since/until, and the structure of the response (data and paging). These details help an agent predict behavior, although it stops short of mentioning authentication, rate limits, or error conditions, which prevents a perfect score.

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 structured with clear sections (Args, Returns, Example) and bullet-pointed parameters, which aids scanability. It front-loads the core purpose and default behavior. The example code is lengthy but illustrates multiple use cases and pagination, earning its place. It is appropriately sized for an 8-parameter tool with no schema descriptions, so not overly verbose.

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?

Given the tool's complexity (8 parameters, no annotations) and the existence of an output schema, the description is remarkably complete: it covers all parameters, return structure, pagination, precedence rules, and provides multiple examples. An agent with access to this description would be equipped to call the tool correctly for common scenarios. The only omission is high-level API access requirements, but these are external to the tool's scope.

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 schema provides only type and title information (0% coverage), so the description fully compensates. It explains the act_id prefix requirement, enumerates available fields with descriptions and allowed values, clarifies pagination cursors, states the format of time_range, and notes precedence rules. This gives an agent complete semantic understanding beyond the schema.

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 precise verb and resource: 'Retrieves activities for a Facebook ad account.' It further clarifies scope by listing the types of changes included (account status, budget, campaign, targeting, audiences) and uses the term 'key updates to an ad account and ad objects associated with it,' which differentiates it from sibling tools like get_activities_by_adset. The purpose is unambiguous and specific.

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

Usage Guidelines3/5

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

The description implies when to use the tool (when retrieving ad account activities, with optional time ranges and pagination) through examples and parameter explanations animation. However, it does not explicitly state when to prefer this tool over alternatives (e.g., get_activities_by_adset) or provide exclusion criteria. Usage context is clear but guidance on alternatives is missing.

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