Skip to main content
Glama

create_rf_prediction

Create a reach and frequency prediction for Meta ad campaigns by providing targeting spec, budget in cents, and scheduling info.

Instructions

Create a new reach & frequency prediction. Provide targeting spec as JSON string, budget in cents, and scheduling info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_specYesJSON string of targeting specification
start_timeYesPrediction start time (ISO 8601 or Unix timestamp)
stop_timeYesPrediction stop time (ISO 8601 or Unix timestamp)
budgetYesBudget in account currency cents
frequency_capYesMaximum frequency cap per user
destination_idYesDestination ID (e.g. Facebook Page ID)

Implementation Reference

  • Handler function for the 'create_rf_prediction' tool. Takes target_spec, start_time, stop_time, budget, frequency_cap, destination_id; sends a POST to /{accountPath}/reachfrequencypredictions on the Meta Ads API.
    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 };
      }
    }
  • Zod schema defining input parameters for create_rf_prediction: target_spec (JSON string), start_time (ISO string), stop_time (ISO string), budget (number cents), frequency_cap (number), destination_id (string).
    {
      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)"),
    },
  • Registration of 'create_rf_prediction' as an MCP tool using server.tool() with name 'create_rf_prediction' and description about creating a reach & frequency prediction.
    // ─── 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 };
        }
      }
    );
  • src/index.ts:83-83 (registration)
    Registration call linking registerReachFrequencyTools into the main server.
    registerReachFrequencyTools(server, client);
  • The AdsClient.post() method used by the handler to POST data to the Meta Ads API.
    async post(
      path: string,
      params?: Record<string, unknown>
    ): Promise<ClientResponse> {
      return this.request("POST", path, params);
    }
    
    async delete(
      path: string,
      params?: Record<string, unknown>
    ): Promise<ClientResponse> {
      return this.request("DELETE", path, params);
    }
    
    // --- Upload (URL-based) ---
Behavior2/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 only states it creates a prediction, but does not disclose side effects, auth requirements, rate limits, idempotency, or what happens on success/failure. Minimal behavioral insight.

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 a single, efficient sentence of 15 words, front-loaded with the purpose. No redundant or irrelevant content.

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

Completeness2/5

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

Given 6 required parameters, no output schema, and no annotations, the description is too brief. It lacks information about return values, success indicators, error conditions, or prerequisites. For a creation tool, this is insufficient for complete understanding.

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% (all 6 parameters have descriptions). The description adds context about target_spec being a JSON string, budget in cents, and scheduling info, which marginally enhances understanding. However, it doesn't clarify format or constraints beyond schema.

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?

Description explicitly states the action 'Create' and the resource 'reach & frequency prediction', and lists key parameters (targeting spec, budget, scheduling). This clearly distinguishes it from sibling tools like get_rf_prediction, delete_rf_prediction, and list_rf_predictions.

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 description implies usage when creating a new RF prediction but provides no explicit guidance on when to use this tool vs alternatives, nor any exclusions or prerequisites. It lacks context about the creation process.

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