Skip to main content
Glama

play_video

Play YouTube or TikTok videos in a lightweight mpv player. Start at specific timestamps or use audio-only mode for podcasts and music while working.

Instructions

Play a video from YouTube or TikTok in a lightweight mpv player window. Optionally start at a specific timestamp. Set audio_only to true for audio-only playback (great for podcasts/music while coding).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesYouTube or TikTok video URL
timestampNoStart position in seconds
audio_onlyNoAudio-only mode — no video window, just audio

Implementation Reference

  • Implementation of the 'play_video' tool, which handles validation, calls mpv.launch, and returns the playback status.
    server.tool(
      'play_video',
      'Play a video from YouTube or TikTok in a lightweight mpv player window. Optionally start at a specific timestamp. Set audio_only to true for audio-only playback (great for podcasts/music while coding).',
      {
        url: z.string().url().describe('YouTube or TikTok video URL'),
        timestamp: z.number().min(0).optional().describe('Start position in seconds'),
        audio_only: z.boolean().default(false).describe('Audio-only mode — no video window, just audio'),
      },
      async ({ url, timestamp, audio_only }) => {
        const urlErr = validateVideoUrl(url);
        if (urlErr) return errorResult(urlErr);
        const depErr = checkDeps();
        if (depErr) return errorResult(depErr);
    
        try {
          await mpv.launch({ url, timestamp, audioOnly: audio_only });
        } catch {
          return errorResult('mpv failed to start. Run `mpv <url>` manually to see the error.');
        }
    
        let title = url;
        try { title = (await mpv.getProperty('media-title')) as string || url; } catch { /* loading */ }
    
        return textResult({ status: 'playing', title, url, audioOnly: audio_only, ...(timestamp ? { startedAt: `${timestamp}s` } : {}) });
      }
    );

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