videos_getVideo
Retrieve detailed information about a YouTube video, such as metadata, by providing the video ID and specifying which parts to fetch using the MCP server's standardized interface.
Instructions
Get detailed information about a YouTube video
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parts | No | Parts of the video to retrieve | |
| videoId | Yes | The YouTube video ID |
Input Schema (JSON Schema)
{
"properties": {
"parts": {
"description": "Parts of the video to retrieve",
"items": {
"type": "string"
},
"type": "array"
},
"videoId": {
"description": "The YouTube video ID",
"type": "string"
}
},
"required": [
"videoId"
],
"type": "object"
}
Implementation Reference
- src/services/video.ts:37-53 (handler)Core handler function in VideoService that fetches detailed YouTube video information using the YouTube Data API v3 videos.list endpoint.async getVideo({ videoId, parts = ['snippet', 'contentDetails', 'statistics'] }: VideoParams): Promise<any> { try { this.initialize(); const response = await this.youtube.videos.list({ part: parts, id: [videoId] }); return response.data.items?.[0] || null; } catch (error) { throw new Error(`Failed to get video: ${error instanceof Error ? error.message : String(error)}`); } }
- src/server.ts:42-62 (registration)Tool registration in the ListTools handler, including name, description, and input schema.{ name: 'videos_getVideo', description: 'Get detailed information about a YouTube video', inputSchema: { type: 'object', properties: { videoId: { type: 'string', description: 'The YouTube video ID', }, parts: { type: 'array', description: 'Parts of the video to retrieve', items: { type: 'string', }, }, }, required: ['videoId'], }, },
- src/server.ts:172-180 (handler)Dispatch handler in MCP server that calls the VideoService.getVideo method and formats the response.case 'videos_getVideo': { const result = await videoService.getVideo(args as unknown as VideoParams); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/types.ts:4-7 (schema)TypeScript interface defining the input parameters for the videos_getVideo tool.export interface VideoParams { videoId: string; parts?: string[]; }