Skip to main content
Glama
dhawalshah

meta-ads-mcp

get_ads_by_adaccount

Retrieve ads from a specific Facebook ad account with filtering, pagination, and custom field selection. Query by account ID, status, date range, and more to get the ad data you need.

Instructions

Retrieves ads from a specific Facebook ad account.

This function allows querying all ads belonging to a specific ad account with various filtering options, pagination, and field selection.

Args: act_id (str): The ID of the ad account to retrieve ads from, prefixed with 'act_', e.g., 'act_1234567890'. fields (Optional[List[str]]): A list of specific fields to retrieve for each ad. If None, a default set of fields will be returned. Common fields include: - 'id': The ad's ID - 'name': The ad's name - 'adset_id': The ID of the ad set this ad belongs to - 'campaign_id': The ID of the campaign this ad belongs to - 'creative': The ad creative details - 'status': The current status of the ad - 'effective_status': The effective status including review status - 'bid_amount': The bid amount for this ad - 'configured_status': The configured status - 'created_time': When the ad was created - 'updated_time': When the ad was last updated - 'targeting': Targeting criteria - 'conversion_specs': Conversion specs - 'recommendations': Recommendations for improving the ad - 'preview_shareable_link': Link for previewing the ad filtering (Optional[List[dict]]): A list of filter objects to apply to the data. Each object should have 'field', 'operator', and 'value' keys. limit (Optional[int]): Maximum number of ads to return per page. Default is 25. after (Optional[str]): Pagination cursor for the next page. From response['paging']['cursors']['after']. before (Optional[str]): Pagination cursor for the previous page. From response['paging']['cursors']['before']. date_preset (Optional[str]): A predefined relative date range for selecting ads. Options include 'today', 'yesterday', 'this_week', etc. time_range (Optional[Dict[str, str]]): A custom time range with 'since' and 'until' dates in 'YYYY-MM-DD' format. updated_since (Optional[int]): Return ads that have been updated since this Unix timestamp. effective_status (Optional[List[str]]): Filter ads by their effective status. Options include: 'ACTIVE', 'PAUSED', 'DELETED', 'PENDING_REVIEW', 'DISAPPROVED', 'PREAPPROVED', 'PENDING_BILLING_INFO', 'CAMPAIGN_PAUSED', 'ARCHIVED', 'ADSET_PAUSED', 'IN_PROCESS', 'WITH_ISSUES'.

Returns: Dict: A dictionary containing the requested ads. The main results are in the 'data' list, and pagination info is in the 'paging' object.

Example: ```python # Get active ads from an ad account ads = get_ads_by_adaccount( act_id="act_123456789", fields=["name", "adset_id", "campaign_id", "effective_status", "created_time"], effective_status=["ACTIVE"], limit=50 )

# Fetch the next page if available using the pagination cursor
next_page_cursor = ads.get("paging", {}).get("cursors", {}).get("after")
if next_page_cursor:
    next_page = get_ads_by_adaccount(
        act_id="act_123456789",
        fields=["name", "adset_id", "campaign_id", "effective_status", "created_time"],
        effective_status=["ACTIVE"],
        limit=50,
        after=next_page_cursor
    )
```

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterNo
limitNo
act_idYes
beforeNo
fieldsNo
filteringNo
time_rangeNo
date_presetNo
updated_sinceNo
effective_statusNo

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, the description carries full responsibility for behavioral disclosure. It does this well: it explains the return structure (data list and paging object), pagination via after/before cursors, filtering semantics, and the default set of fields. It does not mention permissions or rate limits, but for a read-only retrieval operation the disclosed behavior is sufficient.

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 lengthy, but every section earns its place given 10 parameters. It is logically structured (summary, Args, Returns, Example) and front-loaded with the core purpose. The extensive field list is arguably verbose, but for an agent this is valuable reference material. Only minor trimming could improve conciseness.

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?

This is a 10-parameter tool with no schema description coverage and no annotations, yet the description covers all parameters, the return format, pagination, and provides a complete example with next-page handling. The presence of an output schema means the description need not detail return fields, and it does not. Nothing an agent needs to invoke this tool correctly is missing.

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?

Schema description coverage is 0%, so the description must fully compensate. It does: every parameter is explained with types, formats, defaults, and even common values (e.g., effective_status options, field list). The act_id 'act_' prefix, the filter object structure, and pagination cursor usage are all clearly defined. This is exemplary parameter documentation.

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 clear verb–resource pair: 'Retrieves ads from a specific Facebook ad account.' It explicitly narrows the scope to a single ad account, which distinguishes it from sibling tools like get_ads_by_campaign and get_ads_by_adset. The purpose is unambiguous and cannot be confused with others in the same family.

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 context of use is clear — when you need ads by ad account, not by campaign or adset. However, the description never explicitly says 'use this instead of X' or mentions alternatives. It relies on the reader to infer the appropriate scenario from the scope statementaint; no explicit when-not-to-use guidance is given.

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