get_video_info
Extract video metadata from YouTube or TikTok URLs to access title, description, chapters, duration, channel, upload date, view count, and tags without playing the video.
Instructions
Fetch full metadata for a YouTube or TikTok video without playing it: title, description, chapters, duration, channel, upload date, view count, tags.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | YouTube or TikTok video URL |
Implementation Reference
- src/index.ts:218-243 (handler)The tool 'get_video_info' is registered here and defines its logic, which invokes fetchVideoInfo.
server.tool( 'get_video_info', 'Fetch full metadata for a YouTube or TikTok video without playing it: title, description, chapters, duration, channel, upload date, view count, tags.', { url: z.string().url().describe('YouTube or TikTok video URL') }, async ({ url }) => { const urlErr = validateVideoUrl(url); if (urlErr) return errorResult(urlErr); const depErr = checkDeps(); if (depErr) return errorResult(depErr); try { const info = await fetchVideoInfo(url); const chapters = (info.chapters as Array<Record<string, unknown>> | undefined)?.map((ch) => ({ title: ch.title, start: ch.start_time, end: ch.end_time, })) || []; return textResult({ title: info.title, channel: info.channel, upload_date: info.upload_date, duration: info.duration, view_count: info.view_count, like_count: info.like_count, description: info.description, tags: info.tags, chapters, }); } catch (err) { return errorResult(`Error: ${err instanceof Error ? err.message : String(err)}`); } } ); - src/ytdlp.ts:55-60 (helper)The function 'fetchVideoInfo' performs the actual execution of yt-dlp to fetch video metadata.
export function fetchVideoInfo(url: string): Promise<YtEntry> { return spawnYtDlp([ url, '-J', '--no-playlist', '--cookies-from-browser', getBrowser(), ]).then((out) => JSON.parse(out)); }