Skip to main content
Glama

get_video_comments

Retrieve comments from archived Twitch videos to analyze viewer engagement and feedback. Specify video ID and optional parameters for pagination and result limits.

Instructions

アーカイブ動画のコメントを取得します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
videoIdYesビデオID
limitNo取得する最大コメント数(デフォルト: 20)
cursorNo次のページのカーソル

Implementation Reference

  • Main handler function that processes the tool call, fetches comments using GraphQL service, and formats the response.
    export async function handleGetVideoComments(
      gqlService: GraphQLService,
      args: { videoId: string; limit?: number; cursor?: string }
    ) {
      const { comments, nextCursor } = await gqlService.getVideoComments(
        args.videoId,
        args.limit,
        args.cursor
      );
    
      return formatResponse({
        total: comments.length,
        comments,
        pagination: {
          hasNextPage: !!nextCursor,
          nextCursor: nextCursor
        }
      });
    }
  • Tool definition including name, description, and input schema for validation.
    {
      name: 'get_video_comments',
      description: 'アーカイブ動画のコメントを取得します',
      inputSchema: {
        type: 'object',
        properties: {
          videoId: {
            type: 'string',
            description: 'ビデオID',
          },
          limit: {
            type: 'number',
            description: '取得する最大コメント数(デフォルト: 20)',
            minimum: 1,
            maximum: 100,
          },
          cursor: {
            type: 'string',
            description: '次のページのカーソル',
          },
        },
        required: ['videoId'],
      },
    },
  • src/index.ts:153-157 (registration)
    Registration in the main switch statement dispatching tool calls to the handler.
    case 'get_video_comments':
      return await handleGetVideoComments(this.gqlService, {
        videoId: args.videoId as string
      });
  • GraphQL service method that queries Twitch GQL for video comments, processes them, and handles pagination.
    async getVideoComments(videoId: string, limit: number = 20, cursor?: string): Promise<{ comments: any[], nextCursor: string | null }> {
      try {
        // クエリの作成
        const query = cursor
          ? this.createCursorQuery(videoId, cursor)
          : this.createFirstQuery(videoId);
        
        // リクエストの実行
        const response = await this.gqlSession.post('/gql', query);
        const data = response.data;
    
        const comments: any[] = [];
        const edges = data[0]?.data?.video?.comments?.edges || [];
        const pageInfo = data[0]?.data?.video?.comments?.pageInfo;
    
        // コメントの処理(指定された数まで)
        for (let i = 0; i < Math.min(edges.length, limit); i++) {
          comments.push(this.processComment(edges[i]));
        }
    
        // 次のページのカーソルを取得
        let nextCursor: string | null = null;
        if (pageInfo?.hasNextPage && comments.length === limit) {
          nextCursor = edges[edges.length - 1].cursor;
        }
    
        return {
          comments,
          nextCursor
        };
      } catch (error: any) {
        if (error.response?.data?.message) {
          throw new McpError(
            ErrorCode.InvalidParams,
            `GraphQL API error: ${error.response.data.message}`
          );
        }
        throw new McpError(
          ErrorCode.InternalError,
          `Network error: ${error.message}`
        );
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe any behavioral traits such as rate limits, authentication requirements, pagination behavior (beyond the cursor parameter), error conditions, or what format the comments are returned in. For a read operation with no annotation coverage, this leaves significant gaps.

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 in Japanese that directly states the tool's purpose without any unnecessary words or fluff. It's appropriately sized and front-loaded, making it easy to understand at a glance.

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 tool has no annotations, no output schema, and 3 parameters (with 1 required), the description is incomplete. It doesn't explain what the output looks like (e.g., comment format, pagination details), behavioral aspects like rate limits, or how it differs from sibling tools. For a data retrieval tool with multiple parameters, this leaves too much unspecified.

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 schema description coverage is 100%, with all three parameters ('videoId', 'limit', 'cursor') well-documented in the schema itself. The description doesn't add any additional meaning or context beyond what the schema provides (e.g., it doesn't explain what a 'videoId' is or how to obtain it). This meets the baseline for high schema coverage.

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 ('取得します' - get/retrieve) and resource ('アーカイブ動画のコメント' - archived video comments), making the purpose understandable. However, it doesn't distinguish this tool from potential sibling tools like 'get_videos' or 'get_stream_info' that might also retrieve video-related data, so it doesn't reach the highest level of specificity.

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. It doesn't mention any prerequisites, exclusions, or specific contexts (e.g., only for archived videos vs. live streams), nor does it reference sibling tools like 'get_videos' that might be related. Usage is implied but not explicitly defined.

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/mtane0412/twitch-mcp-server'

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