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
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | TikTok username (with or without @) | |
| limit | No | Initial batch size (default 15) | |
| shuffle | No | Shuffle playback order |
Implementation Reference
- src/index.ts:485-506 (handler)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'), },