play_audio
Play audio from YouTube or TikTok videos without the video window. Use for podcasts, music, or background listening while working on other tasks.
Instructions
Play audio only from a YouTube or TikTok video — no video window. Perfect for podcasts, music, and long-form content while you code.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | YouTube or TikTok video URL | |
| timestamp | No | Start position in seconds |
Implementation Reference
- src/index.ts:553-577 (handler)The play_audio tool handler, which validates the URL and dependencies before launching the MPV process in audio-only mode.
server.tool( 'play_audio', 'Play audio only from a YouTube or TikTok video — no video window. Perfect for podcasts, music, and long-form content while you code.', { url: z.string().url().describe('YouTube or TikTok video URL'), timestamp: z.number().min(0).optional().describe('Start position in seconds'), }, async ({ url, timestamp }) => { const urlErr = validateVideoUrl(url); if (urlErr) return errorResult(urlErr); const depErr = checkDeps(); if (depErr) return errorResult(depErr); try { await mpv.launch({ url, timestamp, audioOnly: true }); } catch { return errorResult('mpv failed to start.'); } let title = url; try { title = (await mpv.getProperty('media-title')) as string || url; } catch { /* loading */ } return textResult({ status: 'playing_audio', title, url, ...(timestamp ? { startedAt: `${timestamp}s` } : {}) }); } );