Skip to main content
Glama

Get campaign tree

ads_get_tree
Read-only

Return an ad account's campaigns, ad sets (TikTok ad groups, under the same adSets field) and ads, with spend and delivery metrics for the date range. For LinkedIn, campaigns are campaign groups, adSets are campaigns and ads are creatives. Meta trees come from a copy refreshed every few minutes (fetchedAt says when); reuse a result rather than asking again, and pass refresh only when the user says something just changed in Ads Manager.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "adAccountId": "<adAccountId>"
    },
    "name": "ads_get_tree"
  }
}

Input Schema

NameRequiredDescriptionDefault
sinceNoYYYY-MM-DD. Give both since and until, or neither for the default range.
untilNoYYYY-MM-DD, on or after since, at most 730 days later.
refreshNoMeta: re-read from Meta instead of Adeli's copy, at most once a minute. Only when the user says something just changed outside Adeli; Adeli's own changes already clear the copy.
platformNometa_ads, tiktok_ads or linkedin_ads. Needed only when the profile has more than one ad network and no accountId is given.
accountIdNoThe Facebook accountId from list_accounts. Without it, pass profileId to use that profile's Facebook connection.
profileIdNoA profileId from list_profiles. Optional when accountId is given, which names its profile; if both are given they must agree.
adAccountIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / refresh
      Added value: +{
      +  "description": "Meta: re-read from Meta instead of Adeli's copy, at most once a minute. Only when the user says something just changed outside Adeli; Adeli's own changes already clear the copy.",
      +  "type": "boolean"
      +}
  2. Changed2 schema fields changed
    • changedInput schema / properties / platform / description
      Previous value: -"meta_ads or tiktok_ads. Needed only when the profile has both ad networks and no accountId is given."New value: +"meta_ads, tiktok_ads or linkedin_ads. Needed only when the profile has more than one ad network and no accountId is given."
    • changedInput schema / properties / platform / enum
      Previous value: -[
      -  "meta_ads",
      -  "tiktok_ads"
      -]New value: +[
      +  "meta_ads",
      +  "tiktok_ads",
      +  "linkedin_ads"
      +]
  3. Changed2 schema fields changed
    • changedInput schema / properties / adAccountId / pattern
      Previous value: -"^act_\\d+$"New value: +"^(act_)?\\d+$"
    • addedInput schema / properties / platform
      Added value: +{
      +  "description": "meta_ads or tiktok_ads. Needed only when the profile has both ad networks and no accountId is given.",
      +  "enum": [
      +    "meta_ads",
      +    "tiktok_ads"
      +  ],
      +  "type": "string"
      +}
  4. Changed2 schema fields changed
    • changedInput schema / properties / accountId / description
      Previous value: -"The Facebook accountId from list_accounts. Defaults to the profile's Facebook connection."New value: +"The Facebook accountId from list_accounts. Without it, pass profileId to use that profile's Facebook connection."
    • changedInput schema / properties / profileId / description
      Previous value: -"Defaults to the profile your API key is bound to."New value: +"A profileId from list_profiles. Optional when accountId is given, which names its profile; if both are given they must agree."
  5. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Beyond the readOnlyHint/openWorldHint annotations, the description discloses data provenance and staleness ('a copy refreshed every few minutes (fetchedAt says when)') and the cache-invalidation rule that Adeli's own changes already clear the copy. That is meaningful behavior an agent could not derive from the annotations; only error/permission behavior is omitted.

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?

Three sentences, front-loaded with the purpose, then platform hierarchy mapping, then caching policy; each carries distinct information. The platform-mapping clause is dense but necessary to prevent misinterpretation of adSets across networks.

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

Completeness4/5

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

With no output schema, the description does a good job sketching the return shape (campaigns/adSets/ads plus spend, delivery metrics, fetchedAt) and freshness. Gaps remain around pagination, result-size limits, and behavior when the requested account has no data, which matter for a nested read over potentially large trees.

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

Parameters3/5

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

Schema coverage is 86%, so the parameter meanings are already largely documented. The description adds the refresh decision rule and frames the since/until pair as a metrics window, but it does not document adAccountId (the sole required param, which has no schema description) or clarify how platform/accountId/profileId interact.

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 names a specific verb and resource ('Return an ad account's campaigns, ad sets ... and ads') and states the payload ('spend and delivery metrics for the date range'). It also disambiguates what the hierarchy means per platform, so an agent knows this is a structure-plus-metrics read rather than a flat insight query like ads_get_insights.

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?

It gives explicit operational guidance: 'reuse a result rather than asking again, and pass refresh only when the user says something just changed in Ads Manager,' which tells the agent when to re-call versus trust prior output. It does not, however, route the agent between this tool and metric-focused siblings such as ads_get_insights or ads_list_accounts.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources