Skip to main content
Glama

list_captions

List caption tracks for a YouTube video, showing language, name, status, and draft status. Provide the video ID to retrieve available captions.

Instructions

List caption tracks on a video with their language, name, status, and whether they are drafts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
video_idYesVideo ID to list captions for.

Implementation Reference

  • Schema for list_captions, defining video_id as a required string input.
    const listCaptionsSchema = {
      video_id: z.string().describe("Video ID to list captions for."),
    };
  • Handler for the list_captions tool. Calls client.listCaptions(video_id) and formats the output listing each caption track's id, language, name, trackKind, status, and draft status.
    server.tool(
      "list_captions",
      "List caption tracks on a video with their language, name, status, and whether they are drafts.",
      listCaptionsSchema,
      async (args) => {
        const res = await client.listCaptions(args.video_id);
        if (res.items.length === 0) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Video ${args.video_id} has no caption tracks.`,
              },
            ],
          };
        }
        const lines = [
          `Found ${res.items.length} caption track(s):`,
          ...res.items.map((c) => {
            const s = c.snippet ?? {};
            const draft = s.isDraft ? " [draft]" : "";
            const kind = s.trackKind ? ` (${s.trackKind})` : "";
            return `  ${c.id} — ${s.language ?? "?"} "${s.name ?? ""}"${kind} [${s.status ?? "?"}]${draft}`;
          }),
        ];
        return { content: [{ type: "text" as const, text: lines.join("\n") }] };
      },
    );
  • Registration function registerCaptionTools that calls server.tool("list_captions", ...) along with upload_caption and delete_caption on the MCP server.
    export function registerCaptionTools(
      server: McpServer,
      client: YouTubeClient,
    ): void {
      server.tool(
        "list_captions",
        "List caption tracks on a video with their language, name, status, and whether they are drafts.",
        listCaptionsSchema,
        async (args) => {
          const res = await client.listCaptions(args.video_id);
          if (res.items.length === 0) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Video ${args.video_id} has no caption tracks.`,
                },
              ],
            };
          }
          const lines = [
            `Found ${res.items.length} caption track(s):`,
            ...res.items.map((c) => {
              const s = c.snippet ?? {};
              const draft = s.isDraft ? " [draft]" : "";
              const kind = s.trackKind ? ` (${s.trackKind})` : "";
              return `  ${c.id} — ${s.language ?? "?"} "${s.name ?? ""}"${kind} [${s.status ?? "?"}]${draft}`;
            }),
          ];
          return { content: [{ type: "text" as const, text: lines.join("\n") }] };
        },
      );
    
      server.tool(
        "upload_caption",
        "Upload a caption track (SRT or WebVTT) to a video. Creates a new track — use a distinct `name` per language/track, or `is_draft=true` while iterating.",
        uploadCaptionSchema,
        async (args) => {
          const contentType =
            args.format === "vtt" ? "text/vtt" : "application/x-subrip";
          const bytes = new Uint8Array(Buffer.from(args.caption_text, "utf-8"));
          const result = (await client.insertCaption({
            videoId: args.video_id,
            language: args.language,
            name: args.name,
            isDraft: args.is_draft,
            body: bytes,
            captionContentType: contentType,
          })) as {
            id?: string;
            snippet?: { status?: string };
          };
          return {
            content: [
              {
                type: "text" as const,
                text: [
                  `Uploaded caption track: ${result.id ?? "(unknown id)"}`,
                  `  video: ${args.video_id}`,
                  `  language: ${args.language}`,
                  `  name: "${args.name}"`,
                  `  format: ${args.format}`,
                  `  status: ${result.snippet?.status ?? "?"}`,
                  args.is_draft ? "  (draft — not visible to viewers)" : "",
                ]
                  .filter(Boolean)
                  .join("\n"),
              },
            ],
          };
        },
      );
    
      server.tool(
        "delete_caption",
        "Delete a caption track by ID. Use list_captions to find the track ID first.",
        deleteCaptionSchema,
        async (args) => {
          await client.deleteCaption(args.caption_id);
          return {
            content: [
              {
                type: "text" as const,
                text: `Deleted caption track ${args.caption_id}.`,
              },
            ],
          };
        },
      );
    }
  • src/server.ts:17-17 (registration)
    Import of registerCaptionTools from the captions module.
    import { registerCaptionTools } from "./tools/captions.js";
  • YouTubeClient.listCaptions method that calls the YouTube Data API /captions endpoint with part=snippet and videoId.
    listCaptions(videoId: string): Promise<{
      items: Array<{
        id: string;
        snippet?: {
          name?: string;
          language?: string;
          status?: string;
          isDraft?: boolean;
          lastUpdated?: string;
          trackKind?: string;
        };
      }>;
    }> {
      return this.dataGet("/captions", { part: "snippet", videoId });
    }
Behavior2/5

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

No annotations provided, so description carries full burden. It only states what is returned, but not behavioral traits like being read-only, idempotent, or any authorization requirements.

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, no filler, efficient and front-loaded.

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?

The description covers what the tool returns and its basic purpose. With no output schema, the mention of returned fields is helpful. However, it could mention if there's any default behavior like sorting or pagination limits.

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 description for video_id. The description adds no extra parameter semantics beyond the schema, but the schema already adequately describes the parameter.

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 (list), resource (caption tracks on a video), and specific fields returned (language, name, status, draft status). It distinguishes from sibling tools like delete_caption and 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 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. For example, it doesn't mention that listing captions is a read-only operation or contrast it with other tools.

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