List Channel Videos
channels_listVideosList videos from a YouTube channel by providing its channel ID. Optionally specify a maximum number of results to control the output.
Instructions
Get videos from a specific channel
Input 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)The actual handler logic: ChannelService.listVideos() calls the YouTube Data API v3 search.list endpoint with channelId, sorted by date, filtered to videos only.
async listVideos({ channelId, maxResults = 50 }: ChannelVideosParams): Promise<unknown[]> { 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-utils.ts:221-241 (registration)Tool registration via server.registerTool with name 'channels_listVideos', input schema defined via Zod (channelId required, maxResults optional), and handler that delegates to channelService.listVideos().
server.registerTool( 'channels_listVideos', { title: 'List Channel Videos', description: 'Get videos from a specific channel', annotations: { readOnlyHint: true, idempotentHint: true }, inputSchema: { channelId: z.string().describe('The YouTube channel ID'), maxResults: z.number().optional().describe('Maximum number of results to return'), }, }, async ({ channelId, maxResults }) => { const result = await channelService.listVideos({ channelId, maxResults }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } ); - src/types.ts:61-64 (schema)Type definition for ChannelVideosParams interface with channelId (string) and maxResults (optional number).
export interface ChannelVideosParams { channelId: string; maxResults?: number; }