Skip to main content
Glama

channels_listVideos

Retrieve videos from a YouTube channel by providing the channel ID, enabling content analysis and video discovery.

Instructions

Get videos from a specific channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelIdYesThe YouTube channel ID
maxResultsNoMaximum number of results to return

Implementation Reference

  • Registration of the 'channels_listVideos' MCP tool, including input schema (Zod) and handler function that calls 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)
                }]
            };
        }
    );
  • Core handler implementation in ChannelService.listVideos method, which performs YouTube API search.list call to retrieve videos from the channel.
    /**
     * Get channel videos
     */
    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)}`);
      }
    }
  • TypeScript interface defining parameters for channel videos listing, matching the tool's input schema.
    /**
     * Channel videos parameters
     */
    export interface ChannelVideosParams {
      channelId: string;
      maxResults?: number;
    }
  • Instantiation of ChannelService used by the tool handler.
    const channelService = new ChannelService();
    
    // Register static resource for Smithery discovery
    server.registerResource(
        'info',
  • Tool name listed in the static info resource for discovery.
    "channels_listVideos",

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/sfiorini/youtube-mcp'

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