Skip to main content
Glama

list_comments

Retrieve top-level comments from a YouTube video, sorted newest first, with comment IDs, authors, text, and like counts.

Instructions

List top-level comment threads on a video (newest first). Returns comment IDs, authors, text, and like counts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
video_idYesVideo ID to list comments from
max_resultsNo

Implementation Reference

  • The tool handler function that executes the list_comments logic: calls YouTubeClient.listComments, formats the results into a text response with comment IDs, authors, likes, and reply counts.
    server.tool(
      "list_comments",
      "List top-level comment threads on a video (newest first). Returns comment IDs, authors, text, and like counts.",
      listCommentsSchema,
      async (args) => {
        const data = await client.listComments(args.video_id, args.max_results);
        const lines = [
          `Found ${data.items.length} comment thread(s) on ${args.video_id}:`,
          ...data.items.map((thread) => {
            const top = thread.snippet?.topLevelComment?.snippet;
            const id = thread.snippet?.topLevelComment?.id ?? "?";
            const author = top?.authorDisplayName ?? "?";
            const text = (top?.textOriginal ?? "").replace(/\s+/g, " ").slice(0, 160);
            const likes = top?.likeCount ?? 0;
            const replies = thread.snippet?.totalReplyCount ?? 0;
            return `  ${id} — ${author} (${likes}❤, ${replies}↩): ${text}`;
          }),
        ];
        return { content: [{ type: "text" as const, text: lines.join("\n") }] };
      },
    );
  • Input schema for list_comments: requires a video_id string and an optional max_results number (1-100, default 20).
    const listCommentsSchema = {
      video_id: z.string().describe("Video ID to list comments from"),
      max_results: z.number().int().min(1).max(100).default(20),
    };
  • src/server.ts:49-49 (registration)
    Registration of the comment tools (including list_comments) on the MCP server instance.
    registerCommentTools(s, youtube);
  • YouTubeClient helper method that calls the YouTube Data API v3 /commentThreads endpoint to fetch top-level comments for a video.
    listComments(videoId: string, maxResults = 20): Promise<{ items: CommentThread[] }> {
      return this.dataGet("/commentThreads", {
        part: "snippet,replies",
        videoId,
        maxResults: String(maxResults),
        order: "time",
      });
    }
  • TypeScript type definition for CommentThread returned by the YouTube API, used as the response type for listComments.
    export interface CommentThread {
      id: string;
      snippet?: {
        topLevelComment?: {
          id: string;
          snippet: {
            authorDisplayName: string;
            authorChannelId?: { value: string };
            textDisplay: string;
            textOriginal: string;
            likeCount: number;
            publishedAt: string;
            updatedAt: string;
            moderationStatus?: "heldForReview" | "likelySpam" | "published" | "rejected";
          };
        };
        totalReplyCount?: number;
      };
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits such as authentication requirements, rate limits, or side effects. It only states ordering and return fields, leaving gaps in transparency for an agent.

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?

The description is a single, front-loaded sentence with no extraneous information. It efficiently conveys the core purpose and return value.

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?

While the description mentions return fields, it lacks context on pagination, authentication, rate limits, or whether replies are included. For a simple listing tool, it is adequate but has notable gaps.

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

Parameters2/5

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

Schema coverage is 50% (only video_id has a description). The description adds no additional parameter semantics beyond the schema, leaving max_results undefined in meaning and constraints.

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 verb ('List'), resource ('top-level comment threads on a video'), ordering ('newest first'), and return fields ('comment IDs, authors, text, and like counts'). It distinguishes from sibling tools like moderate_comment and reply_to_comment.

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 implies usage for listing comments, but does not provide explicit guidance on when to use this tool versus alternatives (e.g., for replies, nested comments). No conditions or exclusions are mentioned.

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