Skip to main content
Glama

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
NameRequiredDescriptionDefault
urlYesYouTube or TikTok video URL
timestampNoStart position in seconds

Implementation Reference

  • 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` } : {}) });
      }
    );

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