get_subscription_shorts
Fetch recent YouTube Shorts from your subscribed channels to discover new content. Specify how many channels to sample and Shorts per channel to customize your feed.
Instructions
Fetch recent Shorts from your subscribed YouTube channels. Pulls your subscriptions, then grabs the latest Shorts from each.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max_channels | No | How many subscribed channels to sample (default 15) | |
| shorts_per_channel | No | Shorts to fetch per channel (default 3) |
Implementation Reference
- src/index.ts:351-380 (handler)The handler function for 'get_subscription_shorts' which fetches subscriptions and then gathers Shorts for those channels.
async ({ max_channels, shorts_per_channel }) => { const depErr = checkDeps(); if (depErr) return errorResult(depErr); try { const subsResult = await fetchFeed('https://www.youtube.com/feed/channels', max_channels); const channels = (subsResult.entries || []).slice(0, max_channels); if (channels.length === 0) return textResult('No subscribed channels found.'); const results = await Promise.allSettled( channels.map(async (ch) => { const chUrl = (ch.channel_url || ch.url) as string; if (!chUrl) return []; const result = await fetchFeed(`${stripChannelSuffix(chUrl)}/shorts`, shorts_per_channel); return (result.entries || []).map((e) => ({ ...pickVideoFields(e), channel: (ch.channel || ch.title) as string })); }) ); const allShorts: Array<Record<string, unknown>> = []; for (const r of results) { if (r.status === 'fulfilled') allShorts.push(...r.value); } allShorts.sort((a, b) => String(b.upload_date || '').localeCompare(String(a.upload_date || ''))); const channelNames = channels.map((ch) => (ch.channel || ch.title) as string); return textResult({ channels_sampled: channelNames, count: allShorts.length, shorts: allShorts }); } catch (err) { return errorResult(`Error: ${err instanceof Error ? err.message : String(err)}`); } } - src/index.ts:344-350 (registration)Registration of the 'get_subscription_shorts' tool, including its schema definition.
server.tool( 'get_subscription_shorts', 'Fetch recent Shorts from your subscribed YouTube channels. Pulls your subscriptions, then grabs the latest Shorts from each.', { max_channels: z.number().min(1).max(50).default(15).describe('How many subscribed channels to sample (default 15)'), shorts_per_channel: z.number().min(1).max(10).default(3).describe('Shorts to fetch per channel (default 3)'), },