Skip to main content
Glama

play_shorts

Stream YouTube Shorts as an auto-advancing playlist from specific channels or subscriptions, automatically loading more content as you watch.

Instructions

Play Shorts as a continuous auto-advancing playlist. Automatically fetches more as you watch. Fetch from a specific channel or from your subscribed channels.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYes"channel" or "subscriptions"
channel_urlNoRequired when source is "channel". YouTube channel URL.
max_channelsNoWhen source is "subscriptions": channels to sample (default 15)
shorts_per_channelNoWhen source is "subscriptions": shorts per channel (default 3)
limitNoWhen source is "channel": max shorts (default 15)
shuffleNoShuffle the playback order

Implementation Reference

  • Tool registration and handler implementation for 'play_shorts' which plays YouTube Shorts in mpv, supports channel or subscription sources, and includes auto-refill for channel sources.
    server.tool(
      'play_shorts',
      'Play Shorts as a continuous auto-advancing playlist. Automatically fetches more as you watch. Fetch from a specific channel or from your subscribed channels.',
      {
        source: z.enum(['channel', 'subscriptions']).describe('"channel" or "subscriptions"'),
        channel_url: z.string().url().optional().describe('Required when source is "channel". YouTube channel URL.'),
        max_channels: z.number().min(1).max(50).default(15).describe('When source is "subscriptions": channels to sample (default 15)'),
        shorts_per_channel: z.number().min(1).max(10).default(3).describe('When source is "subscriptions": shorts per channel (default 3)'),
        limit: z.number().min(1).max(50).default(15).describe('When source is "channel": max shorts (default 15)'),
        shuffle: z.boolean().default(false).describe('Shuffle the playback order'),
      },
      async ({ source, channel_url, max_channels, shorts_per_channel, limit, shuffle }) => {
        const depErr = checkDeps();
        if (depErr) return errorResult(depErr);
    
        if (source === 'channel') {
          if (!channel_url) return errorResult('channel_url is required when source is "channel".');
          const urlErr = validateYouTubeUrl(channel_url);
          if (urlErr) return errorResult(urlErr);
        }
    
        let urls: string[];
        try {
          if (source === 'channel') {
            const result = await fetchFeed(`${stripChannelSuffix(channel_url!)}/shorts`, limit);
            urls = (result.entries || []).map((e) => e.url as string).filter(Boolean);
          } else {
            const sub = await fetchSubscriptionShortUrls(max_channels, shorts_per_channel);
            urls = sub.urls;
          }
        } catch (err) {
          return errorResult(`Error fetching shorts: ${err instanceof Error ? err.message : String(err)}`);
        }
    
        if (urls.length === 0) return textResult('No shorts found.');
    
        const playlistFile = mpv.writeTempPlaylist(urls);
    
        try {
          await mpv.launch({ playlistFile, shuffle, socketTimeoutMs: 15_000 });
        } catch {
          return errorResult('mpv failed to start. Run `mpv <url>` manually to see the error.');
        }
    
        // Auto-refill for channel source (subscription source is harder to paginate)
        if (source === 'channel' && channel_url) {
          const shortsUrl = `${stripChannelSuffix(channel_url)}/shorts`;
          mpv.startAutoRefill(urls.length, async (offset, batch) => {
            const more = await fetchFeed(shortsUrl, batch, offset + 1);
            return (more.entries || []).map((e) => e.url as string).filter(Boolean);
          });
        }
    
        let title = 'Shorts playlist';
        try { title = (await mpv.getProperty('media-title')) as string || title; } catch { /* loading */ }
    
        return textResult({ status: 'playing_shorts', title, total: urls.length, shuffle, source, autoRefill: source === 'channel' });
      }
    );
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full disclosure burden. It successfully conveys key behavioral traits (continuous playback, auto-fetching more content) but omits important details like authentication requirements, side effects (watch history updates), or error handling behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three well-structured sentences with zero waste. Front-loaded with the core action ('Play Shorts'), followed by key behavior ('auto-advancing'), then scope options. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given comprehensive schema coverage (100%) and no output schema, the description adequately covers the high-level functionality. However, given the lack of annotations, it should disclose authentication needs for the 'subscriptions' source and potential side effects like watch history modifications.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, establishing a baseline of 3. The description maps the abstract concepts ('specific channel', 'subscribed channels') to the source parameter values but does not add syntax details, format examples, or semantic constraints beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool 'Play Shorts' with specific behavioral details ('continuous auto-advancing playlist'). It effectively distinguishes from siblings like play_video, play_playlist, and get_channel_shorts by specifying 'Shorts' format and the auto-advancing nature.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description outlines the two source options (specific channel vs subscriptions) but lacks explicit guidance on when to choose this tool over siblings like play_video or get_channel_shorts. It does not mention prerequisites like authentication requirements for accessing subscriptions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/ronantakizawa/social-video-mcp'

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