channels_listVideos
Retrieve videos from a specific YouTube channel by providing the channel ID and optional max results. Ideal for accessing and managing YouTube content programmatically.
Instructions
Get videos from a specific channel
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes | The YouTube channel ID | |
| maxResults | No | Maximum number of results to return |
Implementation Reference
- src/services/channel.ts:79-98 (handler)Core handler function implementing the channels_listVideos tool using YouTube Data API v3 search.list to retrieve videos from a channel.async listVideos({ channelId, maxResults = 50 }: ChannelVideosParams): Promise<any[]> { try { this.initialize(); const response = await this.youtube.search.list({ part: ['snippet'], channelId, maxResults, order: 'date', type: ['video'] }); return response.data.items || []; } catch (error) { throw new Error(`Failed to list channel videos: ${error instanceof Error ? error.message : String(error)}`); } }
- src/server.ts:212-219 (registration)Dispatch handler in MCP CallToolRequestHandler that calls the ChannelService.listVideos method.case 'channels_listVideos': { const result = await channelService.listVideos(args as unknown as ChannelVideosParams); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
- src/server.ts:113-130 (registration)Tool registration in ListToolsRequestHandler including name, description, and JSON input schema.{ name: 'channels_listVideos', description: 'Get videos from a specific channel', inputSchema: { type: 'object', properties: { channelId: { type: 'string', description: 'The YouTube channel ID', }, maxResults: { type: 'number', description: 'Maximum number of results to return', }, }, required: ['channelId'], }, },
- src/types.ts:61-64 (schema)TypeScript interface defining the input parameters (ChannelVideosParams) used by the handler and schema.export interface ChannelVideosParams { channelId: string; maxResults?: number; }