Skip to main content
Glama

play_playlist

Play YouTube playlists or channel uploads in mpv. Supports shuffle functionality for varied playback order.

Instructions

Play an entire YouTube playlist in mpv. Supports playlist URLs and channel upload pages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesYouTube playlist or channel URL
shuffleNoShuffle the playlist

Implementation Reference

  • The definition and handler for the 'play_playlist' tool, which uses `mpv.launch` to play the requested URL.
    server.tool(
      'play_playlist',
      'Play an entire YouTube playlist in mpv. Supports playlist URLs and channel upload pages.',
      {
        url: z.string().url().describe('YouTube playlist or channel URL'),
        shuffle: z.boolean().default(false).describe('Shuffle the playlist'),
      },
      async ({ url, shuffle }) => {
        const urlErr = validateYouTubeUrl(url);
        if (urlErr) return errorResult(urlErr);
        const depErr = checkDeps();
        if (depErr) return errorResult(depErr);
    
        try {
          await mpv.launch({ url, shuffle, socketTimeoutMs: 15_000 });
        } catch {
          return errorResult('mpv failed to start. Run `mpv <url>` manually to see the error.');
        }
    
        let title = url;
        let tracks: unknown = null;
        try {
          title = (await mpv.getProperty('media-title')) as string || url;
          tracks = await mpv.getProperty('playlist-count');
        } catch { /* loading */ }
    
        return textResult({ status: 'playing_playlist', title, url, tracks, shuffle });
      }
    );

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