Skip to main content
Glama

update_video_metadata

Update any YouTube video's metadata—title, description, tags, category, or privacy settings—by specifying 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 tool handler for 'update_video_metadata'. Builds a partial patch object from provided args (title, description, tags, category_id, privacy_status), fetches missing required fields (categoryId, title) from YouTube if necessary, then calls client.updateVideo().
    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(", ")})`,
            },
          ],
        };
      },
    );
  • Zod schema for 'update_video_metadata' tool input. Defines video_id (required), title, description, tags, category_id (all optional), and privacy_status (enum: public/unlisted/private).
    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 'update_video_metadata' via server.tool() call inside registerVideoTools().
      "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(", ")})`,
            },
          ],
        };
      },
    );
  • src/server.ts:47-47 (registration)
    The tool is registered at server startup via registerVideoTools(s, youtube) call in buildContext().
    registerVideoTools(s, youtube);
  • Client.updateVideo() helper: sends a PUT request to YouTube Data API /videos endpoint with the partial patch body and part parameter matching the keys being updated.
    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?

With no annotations, the description carries full burden. It indicates mutation by 'update' and hints at idempotency (only changed fields). But it lacks details on destructive side effects, required permissions, rate limits, or return values.

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 superfluous words. Efficiently communicates core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

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

Given no output schema, low schema coverage, and no annotations, the description is too sparse. It does not cover error handling, validation, or typical constraints, leaving the agent underinformed.

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 low (17%). The description lists field names and indicates partial update, adding some context beyond schema. However, field meanings are not elaborated; only category_id has schema description.

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 updates video metadata and lists specific fields (title, description, tags, category, privacy). It distinguishes itself from sibling tools like delete_video or upload_caption.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes 'Only provide fields you want changed,' implying partial update behavior. However, it does not explicitly state when to use this vs alternatives, nor any prerequisites or limitations.

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