youtube_channel
Retrieve and parse video listings from any YouTube channel using its handle or ID.
Instructions
Scrape YouTube channel videos with automatic parsing
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | YouTube channel handle or ID (e.g., "@decodo_official") | |
| limit | No | Maximum number of videos to return |
Implementation Reference
- The handler function that executes youtube_channel tool logic. It receives scrapingParams, builds params with target YOUTUBE_CHANNEL and parse:true, calls sapiClient.scrape(), and returns the data as JSON text content.
async (scrapingParams: ScrapingMCPParams, extra: ProgressExtra) => { const params = { ...scrapingParams, target: SCRAPER_API_TARGETS.YOUTUBE_CHANNEL, parse: true, } satisfies ScraperAPIParams; const { data } = await sapiClient.scrape<object>({ auth, scrapingParams: params, extra }); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } - Input schema: 'query' (string - YouTube channel handle or ID) and 'limit' (optional number - max videos to return).
const zodLimit = z .number() .describe('Maximum number of videos to return') .optional(); - src/tools/youtube-channel/youtube-channel-tool.ts:19-52 (registration)Registration of the 'youtube_channel' tool on the MCP server via server.registerTool().
register = ({ server, sapiClient, auth }: ToolRegistrationArgs) => { server.registerTool( 'youtube_channel', { description: 'Scrape YouTube channel videos with automatic parsing', inputSchema: { query: z.string().describe('YouTube channel handle or ID (e.g., "@decodo_official")'), limit: zodLimit, }, annotations: { readOnlyHint: true, openWorldHint: true, }, }, async (scrapingParams: ScrapingMCPParams, extra: ProgressExtra) => { const params = { ...scrapingParams, target: SCRAPER_API_TARGETS.YOUTUBE_CHANNEL, parse: true, } satisfies ScraperAPIParams; const { data } = await sapiClient.scrape<object>({ auth, scrapingParams: params, extra }); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } ); }; - src/server/sapi-base-server.ts:88-97 (registration)Instantiation of YoutubeChannelTool as part of the allTools array, making it available for registration in the server.
new YoutubeChannelTool(), new YoutubeSubtitlesTool(), new YoutubeSearchTool(), new RedditPostTool(), new RedditSubredditTool(), new RedditUserTool(), new BingSearchTool(), new ChatGPTTool(), new PerplexityTool(), ]; - src/constants.ts:36-38 (helper)Enum constant YOUTUBE_CHANNEL = 'youtube_channel' used as the target parameter for the ScraperAPI.
YOUTUBE_CHANNEL = 'youtube_channel', YOUTUBE_SUBTITLES = 'youtube_subtitles', YOUTUBE_SEARCH = 'youtube_search',