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
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | YouTube playlist or channel URL | |
| shuffle | No | Shuffle the playlist |
Implementation Reference
- src/index.ts:40-68 (handler)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 }); } );