Skip to main content
Glama

get-video-comments

Extract comments from a specific YouTube video by providing the video ID. Use this tool to analyze or export YouTube video comments with ease.

Instructions

Retrieve comments for a specific YouTube video

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxResultsNo
videoIdYes

Implementation Reference

  • Core implementation of fetching YouTube video comments using the YouTube Data API v3 commentThreads.list endpoint. This is the primary logic executed by the tool.
    async getComments(
      videoId: string,
      maxResults: number = 20,
      options: {
        order?: 'time' | 'relevance';
        pageToken?: string;
        includeReplies?: boolean;
      } = {}
    ): Promise<youtube_v3.Schema$CommentThreadListResponse> {
      try {
        const { order = 'relevance', pageToken, includeReplies = false } = options;
    
        const response = await this.youtube.commentThreads.list({
          part: includeReplies ? ['snippet', 'replies'] : ['snippet'],
          videoId,
          maxResults,
          order,
          pageToken
        });
    
        return response.data;
      } catch (error) {
        console.error('Error getting comments:', error);
        throw error;
      }
    }
  • src/index.ts:265-299 (registration)
    MCP server.tool registration for 'get-video-comments', including input schema validation with Zod and the tool handler function that delegates to YouTubeService.getComments and formats the response.
    server.tool(
      'get-video-comments',
      'Retrieve comments for a specific YouTube video with sorting options',
      {
        videoId: z.string().min(1),
        maxResults: z.number().min(1).max(100).optional(),
        order: z.enum(['time', 'relevance']).optional(),
        includeReplies: z.boolean().optional(),
        pageToken: z.string().optional()
      },
      async ({ videoId, maxResults = 20, order = 'relevance', includeReplies = false, pageToken }) => {
        try {
          const commentsData = await youtubeService.getComments(videoId, maxResults, {
            order,
            includeReplies,
            pageToken
          });
    
          return {
            content: [{
              type: 'text',
              text: JSON.stringify(commentsData, null, 2)
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: 'text',
              text: `Error fetching comments: ${error}`
            }],
            isError: true
          };
        }
      }
    );
  • Zod schema defining input parameters for the get-video-comments tool: videoId (required), optional maxResults, order, includeReplies, and pageToken.
    {
      videoId: z.string().min(1),
      maxResults: z.number().min(1).max(100).optional(),
      order: z.enum(['time', 'relevance']).optional(),
      includeReplies: z.boolean().optional(),
      pageToken: z.string().optional()
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions retrieving comments but lacks critical details like whether this is a read-only operation, if it requires authentication, rate limits, pagination behavior, or what the output format looks like. This is inadequate for a tool with zero annotation coverage.

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, efficient sentence that gets straight to the point with no wasted words. It's appropriately sized for a simple retrieval tool and front-loaded with the core purpose.

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 the complexity of a YouTube API tool with no annotations, no output schema, and 2 parameters (one optional), the description is insufficient. It doesn't cover authentication needs, rate limits, error handling, or return format, leaving significant gaps for an AI agent to use it correctly.

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?

The description implies a 'videoId' parameter is needed to specify the video, but doesn't explain what format it expects (e.g., YouTube URL or ID) or mention 'maxResults' at all. With 0% schema description coverage, the description adds minimal value beyond the schema's structural information, meeting the baseline for partial compensation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Retrieve') and resource ('comments for a specific YouTube video'), making the purpose immediately understandable. However, it doesn't differentiate from potential sibling tools like 'get-video-stats' or 'get-video-transcript' that might also retrieve video-related data, so it doesn't reach the highest score.

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?

The description provides no guidance on when to use this tool versus alternatives like 'search-videos' or 'get-video-stats', nor does it mention prerequisites such as needing a valid video ID. It only states what the tool does, not when it's appropriate.

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

Related 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/coyaSONG/youtube-mcp-server'

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