get_tiktok_user_videos
Fetch recent videos from a TikTok user profile using authenticated browser cookies. Specify username and limit to retrieve video content programmatically.
Instructions
Fetch recent videos from a TikTok user profile. Uses Chrome cookies for authentication.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | TikTok username (with or without @) | |
| limit | No | Max videos to return (default 15) |
Implementation Reference
- src/index.ts:445-475 (handler)Registration and implementation of the 'get_tiktok_user_videos' tool, which fetches TikTok user videos.
server.tool( 'get_tiktok_user_videos', 'Fetch recent videos from a TikTok user profile. Uses Chrome cookies for authentication.', { username: z.string().describe('TikTok username (with or without @)'), limit: z.number().min(1).max(30).default(15).describe('Max videos to return (default 15)'), }, async ({ username, limit }) => { const depErr = checkDeps(); if (depErr) return errorResult(depErr); const handle = username.startsWith('@') ? username : `@${username}`; const url = `https://www.tiktok.com/${handle}`; try { const result = await fetchFeed(url, limit); const videos = (result.entries || []).map((e) => ({ title: e.title, url: e.url, duration: e.duration, view_count: e.view_count, like_count: e.like_count, comment_count: e.comment_count, uploader: e.uploader, })); return textResult({ username: handle, count: videos.length, videos }); } catch (err) { return errorResult(`Error: ${err instanceof Error ? err.message : String(err)}`); } } );