Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
partsNoParts of the video to retrieve
videoIdYesThe YouTube video ID

Implementation Reference

  • 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'],
        },
    },
  • 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)
            }]
        };
    }
  • TypeScript interface defining the input parameters for the videos_getVideo tool.
    export interface VideoParams {
      videoId: string;
      parts?: string[];
    }
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ZubeidHendricks/youtube-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server