Skip to main content
Glama

generate_preview

Generate ad previews by inputting creative specs and ad format. Visualize how the ad would appear on Facebook or Instagram without requiring an existing ad.

Instructions

Generate an ad preview without needing an existing ad. Provide creative spec directly to see how it would look.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ad_formatYesAd format: DESKTOP_FEED_STANDARD, MOBILE_FEED_STANDARD, INSTAGRAM_STANDARD, INSTAGRAM_STORY, RIGHT_COLUMN_STANDARD, etc.
creativeYesJSON string of creative spec: {object_story_spec: {...}} or {object_story_id: '...'}

Implementation Reference

  • The generate_preview tool handler: registers an MCP tool that takes ad_format and creative (JSON string of creative spec) as input, calls the Meta Ads API GET /act_{accountId}/generatepreviews endpoint, and returns the preview data with rate limit info.
    // ─── generate_preview ──────────────────────────────────────
    server.tool(
      "generate_preview",
      "Generate an ad preview without needing an existing ad. Provide creative spec directly to see how it would look.",
      {
        ad_format: z.string().describe("Ad format: DESKTOP_FEED_STANDARD, MOBILE_FEED_STANDARD, INSTAGRAM_STANDARD, INSTAGRAM_STORY, RIGHT_COLUMN_STANDARD, etc."),
        creative: z.string().describe("JSON string of creative spec: {object_story_spec: {...}} or {object_story_id: '...'}"),
      },
      async ({ ad_format, creative }) => {
        try {
          const { data, rateLimit } = await client.get(`${client.accountPath}/generatepreviews`, { ad_format, creative });
          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 generate_preview: ad_format (string) and creative (string - JSON of creative spec).
    {
      ad_format: z.string().describe("Ad format: DESKTOP_FEED_STANDARD, MOBILE_FEED_STANDARD, INSTAGRAM_STANDARD, INSTAGRAM_STORY, RIGHT_COLUMN_STANDARD, etc."),
      creative: z.string().describe("JSON string of creative spec: {object_story_spec: {...}} or {object_story_id: '...'}"),
    },
  • Registration of the generate_preview tool on the MCP server via server.tool().
    server.tool(
      "generate_preview",
  • src/index.ts:53-53 (registration)
    Top-level registration: registerCreativeTools(server, client) is called in index.ts which wires up all creative tools including generate_preview.
    registerCreativeTools(server, client);
Behavior2/5

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

No annotations provided, and the description does not disclose behavioral traits such as output format, side effects, permissions, or limitations. The bare minimum is stated, leaving significant gaps for agent decision-making.

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?

Two sentences, front-loaded with purpose, no wasted words. Highly efficient and easy to parse.

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?

For a simple 2-parameter tool with no output schema, the description is adequate but lacks details on output format, error handling, or examples. Could be more complete given the sibling tools.

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 'creative spec directly' but does not provide additional meaning beyond what the schema already describes for the parameters.

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 ('Generate an ad preview') and the resource ('creative spec'), and explicitly distinguishes itself from needing an existing ad ('without needing an existing ad'), differentiating it from siblings like get_ad_preview.

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 implies usage context ('Provide creative spec directly to see how it would look') and explicitly states when not to use it (when you have an existing ad), but lacks explicit mention of alternatives or when to choose this over others.

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