Skip to main content
Glama
Mike25app

scaleforge-mcp-meta-ads

list_adsets

Retrieve ad sets by account or campaign ID. Specify ad_account_id for all adsets in account or campaign_id for adsets of one campaign. Returns key details like id, name, status, budget, bid, optimization goal, and targeting.

Instructions

List ad sets. Pass either ad_account_id (lists all adsets in account) OR campaign_id (lists adsets of one campaign). Returns id, name, campaign_id, status, daily_budget, bid_amount, billing_event, optimization_goal, targeting, is_dynamic_creative.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ad_account_idNo'act_123' or '123'
campaign_idNo
limitNo
afterNo
effective_statusNo
fieldsNo

Implementation Reference

  • The handler function for list_adsets. Makes a GET request to Meta Graph API endpoint `/{parent}/adsets` (parent is either a campaign_id or ad_account_id). Supports optional limit, after (pagination), effective_status, and fields params.
    handler: async (args) => {
      if (!args.ad_account_id && !args.campaign_id) {
        throw new Error(
          "Must provide either ad_account_id or campaign_id to list ad sets.",
        );
      }
      const parent = args.campaign_id
        ? String(args.campaign_id)
        : toAdAccountPath(String(args.ad_account_id));
      return metaGet(`/${parent}/adsets`, {
        fields: args.fields ?? DEFAULT_ADSET_FIELDS,
        limit: args.limit ?? 100,
        after: args.after,
        effective_status: args.effective_status,
      });
    },
  • Input schema for list_adsets. Defines optional Zod-validated params: ad_account_id, campaign_id, limit (int 1-500), after (cursor), effective_status (array of strings), and fields (string). At least one of ad_account_id or campaign_id is required (enforced in handler).
    inputSchema: {
      ad_account_id: z.string().optional().describe("'act_123' or '123'"),
      campaign_id: z.string().optional(),
      limit: z.number().int().positive().max(500).optional(),
      after: z.string().optional(),
      effective_status: z.array(z.string()).optional(),
      fields: z.string().optional(),
    },
  • ToolDef registration for list_adsets as part of the adsetTools array. Exported and spread into allTools in src/index.ts (line 50) and src/http.ts (line 33), then registered via server.registerTool() in both entry points.
    export const adsetTools: ToolDef[] = [
      {
        name: "list_adsets",
        description:
          "List ad sets. Pass either `ad_account_id` (lists all adsets in account) OR " +
          "`campaign_id` (lists adsets of one campaign). Returns id, name, campaign_id, status, " +
          "daily_budget, bid_amount, billing_event, optimization_goal, targeting, is_dynamic_creative.",
        inputSchema: {
          ad_account_id: z.string().optional().describe("'act_123' or '123'"),
          campaign_id: z.string().optional(),
          limit: z.number().int().positive().max(500).optional(),
          after: z.string().optional(),
          effective_status: z.array(z.string()).optional(),
          fields: z.string().optional(),
        },
        handler: async (args) => {
          if (!args.ad_account_id && !args.campaign_id) {
            throw new Error(
              "Must provide either ad_account_id or campaign_id to list ad sets.",
            );
          }
          const parent = args.campaign_id
            ? String(args.campaign_id)
            : toAdAccountPath(String(args.ad_account_id));
          return metaGet(`/${parent}/adsets`, {
            fields: args.fields ?? DEFAULT_ADSET_FIELDS,
            limit: args.limit ?? 100,
            after: args.after,
            effective_status: args.effective_status,
          });
        },
      },
  • Helper function toAdAccountPath: normalizes an ID to 'act_' prefix form, used by the list_adsets handler to build the API path.
    function toAdAccountPath(idOrActId: string): string {
      return idOrActId.startsWith("act_") ? idOrActId : `act_${idOrActId}`;
    }
  • DEFAULT_ADSET_FIELDS constant string listing the default Meta Graph API fields returned by list_adsets.
    const DEFAULT_ADSET_FIELDS =
      "id,name,campaign_id,status,effective_status,daily_budget,lifetime_budget,bid_amount,bid_strategy,billing_event,optimization_goal,targeting,start_time,end_time,is_dynamic_creative,pacing_type,created_time,updated_time";
Behavior2/5

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

No annotations provided. Description only lists returned fields but omits important behavioral details like pagination (limit, after), rate limits, or read-only nature.

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?

Two sentences, front-loaded with purpose, no wasted words. Could be slightly more structured but highly efficient.

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

Completeness3/5

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

Provides basic usage but lacking explanation of pagination, filtering, and optional fields; incomplete for a tool with 6 parameters and no output schema.

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?

Adds meaning for ad_account_id and campaign_id, and lists return fields, but 4 out of 6 parameters (limit, after, effective_status, fields) are undocumented in both schema and description.

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?

Clearly states 'List ad sets' and explains the two key filtering options (by account or campaign), distinguishing it from sibling tools like list_ads or list_campaigns.

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?

Explicitly instructs to pass either ad_account_id or campaign_id, with clear return descriptions. However, lacks guidance on when not to use or alternatives.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Mike25app/scaleforge-mcp-meta-ads'

If you have feedback or need assistance with the MCP directory API, please join our Discord server