get_channel_videos
Retrieve recent video uploads from any YouTube channel by providing the channel URL, with configurable limits for efficient content discovery.
Instructions
List recent video uploads from a specific YouTube channel.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_url | Yes | YouTube channel URL (e.g. https://www.youtube.com/@ChannelName) | |
| limit | No | Max videos to return (default 15) |
Implementation Reference
- src/index.ts:272-286 (handler)The handler function that executes the 'get_channel_videos' tool, fetching videos from the provided channel URL.
async ({ channel_url, limit }) => { const urlErr = validateYouTubeUrl(channel_url); if (urlErr) return errorResult(urlErr); const depErr = checkDeps(); if (depErr) return errorResult(depErr); const url = channel_url.endsWith('/videos') ? channel_url : `${channel_url.replace(/\/$/, '')}/videos`; try { const result = await fetchFeed(url, limit); const videos = (result.entries || []).map(pickVideoFields); return textResult({ channel: result.title || channel_url, count: videos.length, videos }); } catch (err) { return errorResult(`Error: ${err instanceof Error ? err.message : String(err)}`); } } - src/index.ts:265-287 (registration)Registration of the 'get_channel_videos' tool with its input schema definition.
server.tool( 'get_channel_videos', 'List recent video uploads from a specific YouTube channel.', { channel_url: z.string().url().describe('YouTube channel URL (e.g. https://www.youtube.com/@ChannelName)'), limit: z.number().min(1).max(50).default(15).describe('Max videos to return (default 15)'), }, async ({ channel_url, limit }) => { const urlErr = validateYouTubeUrl(channel_url); if (urlErr) return errorResult(urlErr); const depErr = checkDeps(); if (depErr) return errorResult(depErr); const url = channel_url.endsWith('/videos') ? channel_url : `${channel_url.replace(/\/$/, '')}/videos`; try { const result = await fetchFeed(url, limit); const videos = (result.entries || []).map(pickVideoFields); return textResult({ channel: result.title || channel_url, count: videos.length, videos }); } catch (err) { return errorResult(`Error: ${err instanceof Error ? err.message : String(err)}`); } } );