Skip to main content
Glama

create_ad

Create a new ad by specifying name, ad set ID, and creative JSON. Default status is PAUSED; optionally set status and tracking specs.

Instructions

Create a new ad. Requires name, adset_id, and creative (JSON object_story_spec). Defaults to PAUSED status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesAd name
adset_idYesParent ad set ID
creativeYesJSON string of creative spec (object_story_spec with page_id, link_data/photo_data/video_data)
statusNoAd status (default PAUSED)PAUSED
tracking_specsNoJSON string of tracking specs array

Implementation Reference

  • The create_ad tool handler: registers an MCP tool named 'create_ad' that accepts name, adset_id, creative (JSON), optional status (default PAUSED), and optional tracking_specs. It POSTs to the Meta Ads API endpoint /act_{account_id}/ads to create a new ad.
    server.tool(
      "create_ad",
      "Create a new ad. Requires name, adset_id, and creative (JSON object_story_spec). Defaults to PAUSED status.",
      {
        name: z.string().describe("Ad name"),
        adset_id: z.string().describe("Parent ad set ID"),
        creative: z.string().describe("JSON string of creative spec (object_story_spec with page_id, link_data/photo_data/video_data)"),
        status: z.string().optional().default("PAUSED").describe("Ad status (default PAUSED)"),
        tracking_specs: z.string().optional().describe("JSON string of tracking specs array"),
      },
      async ({ name, adset_id, creative, status, tracking_specs }) => {
        try {
          const params: Record<string, unknown> = { name, adset_id, creative, status };
          if (tracking_specs) params.tracking_specs = tracking_specs;
          const { data, rateLimit } = await client.post(`${client.accountPath}/ads`, 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 for create_ad input: name (string), adset_id (string), creative (JSON string), status (string, default PAUSED), tracking_specs (optional JSON string).
    {
      name: z.string().describe("Ad name"),
      adset_id: z.string().describe("Parent ad set ID"),
      creative: z.string().describe("JSON string of creative spec (object_story_spec with page_id, link_data/photo_data/video_data)"),
      status: z.string().optional().default("PAUSED").describe("Ad status (default PAUSED)"),
      tracking_specs: z.string().optional().describe("JSON string of tracking specs array"),
    },
  • src/index.ts:52-52 (registration)
    Registration call: registerAdTools(server, client) is invoked in the main server setup, which registers the create_ad (and all other ad) tools on the MCP server.
    registerAdTools(server, client);
  • src/tools/ads.ts:5-5 (registration)
    Function signature export: export function registerAdTools(server, client) that registers all ad-related tools including create_ad.
    export function registerAdTools(server: McpServer, client: AdsClient): void {
  • The AdsClient.post() method used by create_ad to make the HTTP POST request to the Meta Ads Graph API.
    async post(
      path: string,
      params?: Record<string, unknown>
    ): Promise<ClientResponse> {
      return this.request("POST", path, params);
Behavior3/5

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

No annotations provided, so description carries full burden. It notes default PAUSED status but lacks details on side effects, authorization, or rate limits. Adequate but not thorough.

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?

One sentence, concise, front-loaded with verb and key constraints. No wasted words.

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?

No output schema, and description does not explain return values or error conditions. For a creation tool with 5 params, it covers essentials but lacks completeness.

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. Description adds minor context about creative being object_story_spec, but otherwise does not enrich parameter meanings 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?

The description clearly states the tool creates a new ad, with specific required fields and default status. It distinguishes from sibling tools like create_adset and create_campaign.

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 lists required parameters upfront, giving basic guidance on what is needed. However, it does not explicitly compare to alternatives like copy_ad or update_ad.

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