Skip to main content
Glama
dhawalshah

meta-ads-mcp

get_ads_by_adset

Retrieve ads from a specific Facebook ad set by ID, using filters, pagination, and field selection to get only the data you need.

Instructions

Retrieves ads associated with a specific Facebook ad set.

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

Args: adset_id (str): The ID of the ad set to retrieve ads from. fields (Optional[List[str]]): A list of specific fields to retrieve for each ad. If None, a default set of fields will be returned. See get_ad_by_id for a comprehensive list of available fields. filtering (Optional[List[dict]]): A list of filter objects to apply to the data. Each object should have 'field', 'operator', and 'value' keys. Operators include: 'EQUAL', 'NOT_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL', 'IN_RANGE', 'NOT_IN_RANGE', 'CONTAIN', 'NOT_CONTAIN', 'IN', 'NOT_IN', 'EMPTY', 'NOT_EMPTY'. limit (Optional[int]): Maximum number of ads to return per page. Default is 25, max is 100. 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']. 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', 'IN_PROCESS', 'WITH_ISSUES'. date_format (Optional[str]): Format for date responses. Options: - 'U': Unix timestamp (seconds since epoch) - 'Y-m-d H:i:s': MySQL datetime format - None: ISO 8601 format (default)

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 all active ads from an ad set ads = get_ads_by_adset( adset_id="23843211234567", fields=["name", "campaign_id", "effective_status", "created_time", "creative"], effective_status=["ACTIVE"], limit=50 )

# Get ads with specific fields and date format
time_ads = get_ads_by_adset(
    adset_id="23843211234567",
    fields=["name", "created_time", "updated_time", "status"],
    date_format="Y-m-d H:i:s"
)

# 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_adset(
        adset_id="23843211234567",
        fields=["name", "campaign_id", "effective_status", "created_time", "creative"],
        effective_status=["ACTIVE"],
        limit=50,
        after=next_page_cursor
    )
```

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterNo
limitNo
beforeNo
fieldsNo
adset_idYes
filteringNo
date_formatNo
effective_statusNo

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?

No annotations are provided, so the description carries the full burden. It discloses pagination behavior (cursors, limit, before/after), default field behavior, date format options, and effective status filtering. It also explains the return structure (data list, paging object). This is substantial behavioral context beyond the schema. It doesn't mention rate limits or auth requirements, but for a read operation this is adequate.

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 well-structured with clear sections (Args, Returns, Example) and front-loads the core purpose. It is somewhat long due to the comprehensive parameter documentation and examples, but every section earns its place. The examples are useful but could be trimmed to one to reduce length. Overall, it's organized and scannable.

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, pagination, filtering, multiple date formats), the description is complete. It covers all parameters, return structure, pagination flow, and provides a working example. The output schema exists, so return values are further documented. An agent has everything needed to call this tool correctly without additional inference.

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, defaults, options, and examples. The filtering parameter gets detailed operator lists, date_format gets explicit format strings, and pagination parameters reference the response structure. The example usage demonstrates real parameter combinations. This is exemplary compensation for a schema with no descriptions.

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 clearly states the tool retrieves ads associated with a specific Facebook ad set, with a specific verb ('Retrieves') and resource ('ads...ad set'). It distinguishes itself from siblings like get_ads_by_campaign and get_ads_by_adaccount by explicitly scoping to adset_id. The title and description align, and the resource 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 this tool: when querying ads belonging to a specific ad set. It includes filtering, pagination, and field selection guidance. However, it does not explicitly state when NOT to use it or name alternatives like get_ads_by_campaign or get_ads_by_adaccount, which would strengthen the guidance. The example showing pagination usage is helpful.

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