get_video
Retrieve complete video details including snippet, status, statistics, and duration by providing the YouTube video ID.
Instructions
Fetch full details for one video by ID — snippet, status, statistics, duration.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| video_id | Yes | YouTube video ID (the part after v= in the URL) |
Implementation Reference
- src/tools/videos.ts:62-73 (handler)The handler function for the 'get_video' tool. Calls client.getVideo(args.video_id) and returns the full video details as JSON.
async (args) => { const data = await client.getVideo(args.video_id); const video = data.items[0]; if (!video) { return { content: [{ type: "text" as const, text: `Video not found: ${args.video_id}` }] }; } return { content: [ { type: "text" as const, text: JSON.stringify(video, null, 2) }, ], }; }, - src/tools/videos.ts:10-12 (schema)Input schema for the 'get_video' tool. Defines a single required parameter: video_id (string).
const getVideoSchema = { video_id: z.string().describe("YouTube video ID (the part after v= in the URL)"), }; - src/tools/videos.ts:58-74 (registration)Registration of the 'get_video' tool on the McpServer via server.tool() with schema and handler.
server.tool( "get_video", "Fetch full details for one video by ID — snippet, status, statistics, duration.", getVideoSchema, async (args) => { const data = await client.getVideo(args.video_id); const video = data.items[0]; if (!video) { return { content: [{ type: "text" as const, text: `Video not found: ${args.video_id}` }] }; } return { content: [ { type: "text" as const, text: JSON.stringify(video, null, 2) }, ], }; }, ); - src/youtube/client.ts:160-165 (helper)Low-level API method getVideo() on YouTubeClient. Makes a GET request to YouTube Data API v3 /videos with snippet,status,statistics,contentDetails parts.
getVideo(videoId: string): Promise<{ items: Video[] }> { return this.dataGet("/videos", { part: "snippet,status,statistics,contentDetails", id: videoId, }); } - src/youtube/types.ts:1-5 (helper)Type definition for VideoListResponse (return type of getVideo) and Video interface.
export interface VideoListResponse { items: Video[]; nextPageToken?: string; pageInfo?: { totalResults: number; resultsPerPage: number }; }