Skip to main content
Glama

list_rf_predictions

Retrieve reach and frequency predictions for an ad account, with support for pagination and field selection.

Instructions

List reach & frequency predictions for the ad account. Returns paginated results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNoComma-separated fields to return
limitNoNumber of results (default 25)
afterNoPagination cursor for next page

Implementation Reference

  • Handler function for 'list_rf_predictions' tool. Calls client.get() to fetch reachfrequencypredictions from the Meta Ads API with optional fields, limit, and pagination cursor. Returns paginated results or error.
    server.tool(
      "list_rf_predictions",
      "List reach & frequency predictions for the ad account. Returns paginated results.",
      {
        fields: z.string().optional().describe("Comma-separated fields to return"),
        limit: z.number().optional().default(25).describe("Number of results (default 25)"),
        after: z.string().optional().describe("Pagination cursor for next page"),
      },
      async ({ fields, limit, after }) => {
        try {
          const params: Record<string, unknown> = {};
          if (fields) params.fields = fields;
          if (limit) params.limit = limit;
          if (after) params.after = after;
          const { data, rateLimit } = await client.get(`${client.accountPath}/reachfrequencypredictions`, params);
          return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • Input schema for 'list_rf_predictions': optional 'fields' (comma-separated string), optional 'limit' (number, default 25), optional 'after' (pagination cursor string). Defined using Zod.
    {
      fields: z.string().optional().describe("Comma-separated fields to return"),
      limit: z.number().optional().default(25).describe("Number of results (default 25)"),
      after: z.string().optional().describe("Pagination cursor for next page"),
    },
  • The function registerReachFrequencyTools registers all RF tools on an McpServer instance including 'list_rf_predictions' via server.tool().
    export function registerReachFrequencyTools(server: McpServer, client: AdsClient): void {
      // ─── list_rf_predictions ──────────────────────────────────────
      server.tool(
        "list_rf_predictions",
        "List reach & frequency predictions for the ad account. Returns paginated results.",
        {
          fields: z.string().optional().describe("Comma-separated fields to return"),
          limit: z.number().optional().default(25).describe("Number of results (default 25)"),
          after: z.string().optional().describe("Pagination cursor for next page"),
        },
        async ({ fields, limit, after }) => {
          try {
            const params: Record<string, unknown> = {};
            if (fields) params.fields = fields;
            if (limit) params.limit = limit;
            if (after) params.after = after;
            const { data, rateLimit } = await client.get(`${client.accountPath}/reachfrequencypredictions`, params);
            return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
          } catch (error) {
            return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
          }
        }
      );
    
      // ─── create_rf_prediction ─────────────────────────────────────
      server.tool(
        "create_rf_prediction",
        "Create a new reach & frequency prediction. Provide targeting spec as JSON string, budget in cents, and scheduling info.",
        {
          target_spec: z.string().describe("JSON string of targeting specification"),
          start_time: z.string().describe("Prediction start time (ISO 8601 or Unix timestamp)"),
          stop_time: z.string().describe("Prediction stop time (ISO 8601 or Unix timestamp)"),
          budget: z.number().describe("Budget in account currency cents"),
          frequency_cap: z.number().describe("Maximum frequency cap per user"),
          destination_id: z.string().describe("Destination ID (e.g. Facebook Page ID)"),
        },
        async ({ target_spec, start_time, stop_time, budget, frequency_cap, destination_id }) => {
          try {
            const params: Record<string, unknown> = {
              target_spec,
              start_time,
              stop_time,
              budget,
              frequency_cap,
              destination_id,
            };
            const { data, rateLimit } = await client.post(`${client.accountPath}/reachfrequencypredictions`, params);
            return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
          } catch (error) {
            return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
          }
        }
      );
    
      // ─── get_rf_prediction ────────────────────────────────────────
      server.tool(
        "get_rf_prediction",
        "Get details of a specific reach & frequency prediction by ID.",
        {
          prediction_id: z.string().describe("Prediction ID"),
          fields: z.string().optional().describe("Comma-separated fields to return"),
        },
        async ({ prediction_id, fields }) => {
          try {
            const params: Record<string, unknown> = {};
            if (fields) params.fields = fields;
            const { data, rateLimit } = await client.get(`/${prediction_id}`, params);
            return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
          } catch (error) {
            return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
          }
        }
      );
    
      // ─── delete_rf_prediction ─────────────────────────────────────
      server.tool(
        "delete_rf_prediction",
        "Delete a reach & frequency prediction. This action is irreversible.",
        {
          prediction_id: z.string().describe("Prediction ID to delete"),
        },
        async ({ prediction_id }) => {
          try {
            const { data, rateLimit } = await client.delete(`/${prediction_id}`);
            return { content: [{ type: "text" as const, text: JSON.stringify({ success: true, ...data as object, _rateLimit: rateLimit }, null, 2) }] };
          } catch (error) {
            return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
          }
        }
      );
    }
  • src/index.ts:27-27 (registration)
    Import of the registerReachFrequencyTools function in the main entry point.
    import { registerReachFrequencyTools } from "./tools/reach_frequency.js";
  • src/index.ts:83-83 (registration)
    Registration call: registerReachFrequencyTools(server, client) in the main server setup.
    registerReachFrequencyTools(server, client);
Behavior2/5

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

With no annotations, the description carries the full burden. It mentions pagination but does not disclose safety (e.g., it's a read operation), authorization needs, rate limits, or the format of returned data. The behavior is minimally transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise: two sentences with no wasted words. The first sentence front-loads the purpose, and the second sentence adds a key behavioral detail (paginated results).

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?

Given the lack of output schema and annotations, the description is adequate but incomplete. It does not explain the response format, default limit, or that fields can customize the output. For an AI agent, more detail would be beneficial.

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 100%, so baseline is 3. The description adds 'paginated results' which implicitly explains the 'after' parameter, but does not add extra meaning for 'fields' or 'limit' beyond the schema 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 action (List) and the resource (reach & frequency predictions), and mentions pagination. It distinguishes this tool from sibling tools like get_rf_prediction by implying it returns multiple predictions.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives like get_rf_prediction (for a single prediction) or create_rf_prediction. The description does not specify context or prerequisites.

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/mikusnuz/meta-ads-mcp'

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