Skip to main content
Glama

delete_video

Delete an ad video permanently to remove it from your Meta Ads library. Note: this action is irreversible.

Instructions

Delete an ad video. This action is irreversible.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
video_idYesVideo ID to delete

Implementation Reference

  • The async handler function that executes the delete_video tool logic. It calls client.delete with the video_id and returns success/failure.
    async ({ video_id }) => {
      try {
        const { data, rateLimit } = await client.delete(`/${video_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 };
      }
    }
  • Zod schema defining the input parameter: video_id (string).
    {
      video_id: z.string().describe("Video ID to delete"),
    },
  • Registration of the delete_video tool on the MCP server using server.tool() with name, description, schema, and handler.
    server.tool(
      "delete_video",
      "Delete an ad video. This action is irreversible.",
      {
        video_id: z.string().describe("Video ID to delete"),
      },
      async ({ video_id }) => {
        try {
          const { data, rateLimit } = await client.delete(`/${video_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:57-57 (registration)
    Call site where registerVideoTools is invoked, registering all video tools including delete_video.
    registerVideoTools(server, client);
  • The registerVideoTools function that registers all video-related tools (list, upload, get, delete) on the server.
    export function registerVideoTools(server: McpServer, client: AdsClient): void {
      // ─── list_videos ───────────────────────────────────────────
      server.tool(
        "list_videos",
        "List ad videos uploaded to the ad account.",
        {
          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}/advideos`, 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 };
          }
        }
      );
    
      // ─── upload_video ──────────────────────────────────────────
      server.tool(
        "upload_video",
        "Upload an ad video from a public URL. Returns video ID for use in ad creatives.",
        {
          file_url: z.string().describe("Public URL of the video to upload"),
          title: z.string().optional().describe("Video title"),
          description: z.string().optional().describe("Video description"),
        },
        async ({ file_url, title, description }) => {
          try {
            const params: Record<string, unknown> = { file_url };
            if (title) params.title = title;
            if (description) params.description = description;
            const { data, rateLimit } = await client.post(`${client.accountPath}/advideos`, 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_video ─────────────────────────────────────────────
      server.tool(
        "get_video",
        "Get details of a specific ad video by ID.",
        {
          video_id: z.string().describe("Video ID"),
          fields: z.string().optional().describe("Comma-separated fields to return"),
        },
        async ({ video_id, fields }) => {
          try {
            const params: Record<string, unknown> = {};
            if (fields) params.fields = fields;
            const { data, rateLimit } = await client.get(`/${video_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_video ──────────────────────────────────────────
      server.tool(
        "delete_video",
        "Delete an ad video. This action is irreversible.",
        {
          video_id: z.string().describe("Video ID to delete"),
        },
        async ({ video_id }) => {
          try {
            const { data, rateLimit } = await client.delete(`/${video_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 };
          }
        }
      );
    }
Behavior3/5

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

No annotations are provided, so the description carries full burden. It mentions irreversibility, which is critical, but lacks details on permissions, rate limits, or response behavior. Minimal but acceptable for a simple destructive operation.

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 action, 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.

Completeness4/5

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

For a simple one-parameter delete tool without output schema, the description is mostly sufficient. It covers the irreversible nature. Could mention if deletion is immediate or requires video existence, but overall adequate.

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% with clear parameter description. The description adds no additional meaning to the parameter beyond what the schema already provides, so baseline score applies.

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 'Delete an ad video' and highlights irreversibility, which distinguishes it from sibling delete tools for other entities like campaigns or adsets.

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 vs other delete tools, when not to use it, or prerequisites. The agent gets no context on alternatives or conditions.

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