Skip to main content
Glama

update_video_metadata

Modify YouTube video metadata such as title, description, tags, category, and privacy status. Submit only the fields you want to change.

Instructions

Update a video's metadata — title, description, tags, category, or privacy. Only provide fields you want changed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
video_idYes
titleNo
descriptionNo
tagsNo
category_idNoYouTube category ID as a string (e.g. '22' = People & Blogs, '27' = Education, '28' = Science & Tech)
privacy_statusNo

Implementation Reference

  • The handler function for the update_video_metadata tool. It builds a patch object from the provided fields (title, description, tags, category_id, privacy_status), fetches current video data if needed to fill required snippet fields (categoryId, title), then calls client.updateVideo().
    async (args) => {
      const patch: Record<string, unknown> = {};
      const snippet: Record<string, unknown> = {};
      const status: Record<string, unknown> = {};
    
      if (args.title !== undefined) snippet.title = args.title;
      if (args.description !== undefined) snippet.description = args.description;
      if (args.tags !== undefined) snippet.tags = args.tags;
      if (args.category_id !== undefined) snippet.categoryId = args.category_id;
      if (args.privacy_status !== undefined) status.privacyStatus = args.privacy_status;
    
      if (Object.keys(snippet).length > 0) {
        // Category is required when updating snippet — fetch current if user didn't supply one.
        if (!snippet.categoryId) {
          const current = await client.getVideo(args.video_id);
          const existingCategory = current.items[0]?.snippet?.categoryId;
          if (!existingCategory) {
            throw new Error("Video has no category — pass category_id explicitly");
          }
          snippet.categoryId = existingCategory;
        }
        // Title is required for a snippet update.
        if (!snippet.title) {
          const current = await client.getVideo(args.video_id);
          const existingTitle = current.items[0]?.snippet?.title;
          if (!existingTitle) throw new Error("Cannot update snippet without a title");
          snippet.title = existingTitle;
        }
        patch.snippet = snippet;
      }
      if (Object.keys(status).length > 0) patch.status = status;
    
      if (Object.keys(patch).length === 0) {
        return { content: [{ type: "text" as const, text: "No fields to update." }] };
      }
    
      await client.updateVideo(args.video_id, patch);
      return {
        content: [
          {
            type: "text" as const,
            text: `Updated video ${args.video_id} (${Object.keys(patch).join(", ")})`,
          },
        ],
      };
    },
  • Zod schema for update_video_metadata input validation: video_id (required), title, description, tags, category_id, privacy_status (all optional).
    const updateVideoMetadataSchema = {
      video_id: z.string(),
      title: z.string().optional(),
      description: z.string().optional(),
      tags: z.array(z.string()).optional(),
      category_id: z
        .string()
        .optional()
        .describe(
          "YouTube category ID as a string (e.g. '22' = People & Blogs, '27' = Education, '28' = Science & Tech)",
        ),
      privacy_status: z.enum(["public", "unlisted", "private"]).optional(),
    };
  • Registration of the 'update_video_metadata' tool on the MCP server via server.tool(), with its schema and handler, inside the registerVideoTools() function.
    server.tool(
      "update_video_metadata",
      "Update a video's metadata — title, description, tags, category, or privacy. Only provide fields you want changed.",
      updateVideoMetadataSchema,
      async (args) => {
        const patch: Record<string, unknown> = {};
        const snippet: Record<string, unknown> = {};
        const status: Record<string, unknown> = {};
    
        if (args.title !== undefined) snippet.title = args.title;
        if (args.description !== undefined) snippet.description = args.description;
        if (args.tags !== undefined) snippet.tags = args.tags;
        if (args.category_id !== undefined) snippet.categoryId = args.category_id;
        if (args.privacy_status !== undefined) status.privacyStatus = args.privacy_status;
    
        if (Object.keys(snippet).length > 0) {
          // Category is required when updating snippet — fetch current if user didn't supply one.
          if (!snippet.categoryId) {
            const current = await client.getVideo(args.video_id);
            const existingCategory = current.items[0]?.snippet?.categoryId;
            if (!existingCategory) {
              throw new Error("Video has no category — pass category_id explicitly");
            }
            snippet.categoryId = existingCategory;
          }
          // Title is required for a snippet update.
          if (!snippet.title) {
            const current = await client.getVideo(args.video_id);
            const existingTitle = current.items[0]?.snippet?.title;
            if (!existingTitle) throw new Error("Cannot update snippet without a title");
            snippet.title = existingTitle;
          }
          patch.snippet = snippet;
        }
        if (Object.keys(status).length > 0) patch.status = status;
    
        if (Object.keys(patch).length === 0) {
          return { content: [{ type: "text" as const, text: "No fields to update." }] };
        }
    
        await client.updateVideo(args.video_id, patch);
        return {
          content: [
            {
              type: "text" as const,
              text: `Updated video ${args.video_id} (${Object.keys(patch).join(", ")})`,
            },
          ],
        };
      },
    );
  • The YouTubeClient.updateVideo() helper method that sends a PUT request to the YouTube Data API /videos endpoint with the constructed patch body.
    updateVideo(videoId: string, patch: Partial<Video>): Promise<Video> {
      const body = { id: videoId, ...patch };
      return this.dataPut<Video>("/videos", { part: Object.keys(patch).join(",") }, body);
    }
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 describes the update operation but does not disclose side effects, auth requirements, rate limits, or whether changes are irreversible. The partial update hint is helpful but not exhaustive.

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, no redundancy. The purpose is front-loaded, and the partial update instruction is concise.

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 6-parameter tool with no output schema, the description covers the essential update semantics. It implies that only provided fields are changed, which is critical. Could mention that omitted fields remain unchanged, but it's already clear from 'Only provide fields you want changed.'

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is low (17% – only category_id has a description). The description compensates by listing the fields and emphasizing partial updates, adding meaning beyond the schema's property names and types. However, it does not explain formatting for tags or category_id further.

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 it updates video metadata, listing specific fields (title, description, tags, category, privacy). This distinguishes it from sibling tools like delete_video or get_video.

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 explicitly says 'Only provide fields you want changed,' indicating a partial update pattern. It does not explicitly state when to use vs. alternatives, but the context is clear.

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/miller-joe/youtube-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server