Skip to main content
Glama

play_tiktok_user

Stream TikTok videos from a specific user as an auto-advancing playlist that continuously loads more content as you watch.

Instructions

Play videos from a TikTok user as a continuous auto-advancing playlist. Automatically fetches more videos as you watch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesTikTok username (with or without @)
limitNoInitial batch size (default 15)
shuffleNoShuffle playback order

Implementation Reference

  • The handler function for the 'play_tiktok_user' tool, which fetches videos for a user and launches an MPV playlist.
    async ({ username, limit, shuffle }) => {
      const depErr = checkDeps();
      if (depErr) return errorResult(depErr);
    
      const handle = username.startsWith('@') ? username : `@${username}`;
      const feedUrl = `https://www.tiktok.com/${handle}`;
    
      try {
        const result = await fetchFeed(feedUrl, limit);
        const urls = (result.entries || []).map((e) => e.url as string).filter(Boolean);
        if (urls.length === 0) return textResult('No videos found.');
    
        const playlistFile = mpv.writeTempPlaylist(urls);
        await mpv.launch({ playlistFile, shuffle, socketTimeoutMs: 15_000 });
    
        // Auto-refill: fetch more videos as the playlist runs low
        mpv.startAutoRefill(urls.length, async (offset, batch) => {
          const more = await fetchFeed(feedUrl, batch, offset + 1);
          return (more.entries || []).map((e) => e.url as string).filter(Boolean);
        });
    
        let title = handle;
  • src/index.ts:477-484 (registration)
    The registration of the 'play_tiktok_user' tool using server.tool.
    server.tool(
      'play_tiktok_user',
      'Play videos from a TikTok user as a continuous auto-advancing playlist. Automatically fetches more videos as you watch.',
      {
        username: z.string().describe('TikTok username (with or without @)'),
        limit: z.number().min(1).max(30).default(15).describe('Initial batch size (default 15)'),
        shuffle: z.boolean().default(false).describe('Shuffle playback order'),
      },

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