Skip to main content
Glama

get_video

Retrieve details for a specific ad video using its ID.

Instructions

Get details of a specific ad video by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
video_idYesVideo ID
fieldsNoComma-separated fields to return

Implementation Reference

  • The handler function for the 'get_video' tool. It accepts 'video_id' (required) and 'fields' (optional) as parameters, constructs a GET request to the Meta Ads API using the AdsClient, and returns the video details as JSON.
    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 };
        }
      }
    );
  • The Zod schema for the 'get_video' tool's input parameters: 'video_id' (required string) and 'fields' (optional string).
    {
      video_id: z.string().describe("Video ID"),
      fields: z.string().optional().describe("Comma-separated fields to return"),
    },
  • The 'registerVideoTools' function that registers all video tools (list_videos, upload_video, get_video, delete_video) on the MCP server. Called from src/index.ts line 57.
    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 };
          }
        }
      );
    }
  • The AdsClient.get() helper method used by the get_video handler to make a GET request to the Meta Ads API.
    async get(
      path: string,
      params?: Record<string, unknown>
    ): Promise<ClientResponse> {
      return this.request("GET", path, params);
    }
  • src/index.ts:55-57 (registration)
    The call in the main server setup that registers all video tools (including get_video) on the MCP server instance.
    // --- Assets ---
    registerImageTools(server, client);
    registerVideoTools(server, client);
Behavior2/5

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

With no annotations provided, the description only implies a read operation without disclosing potential side effects, permissions, or error handling.

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?

Single sentence, front-loaded with key information, no unnecessary 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?

The description is adequate for a simple read operation but could mention what details are returned, especially since there is no output schema.

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 already covers both parameters with descriptions; the description adds no additional meaning beyond 'by ID', so baseline 3.

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 (get details) and resource (specific ad video by ID), which distinguishes it from sibling tools like list_videos or delete_video.

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 (e.g., searching or listing videos), nor any conditions for using it.

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