get_video_info
Retrieve video metadata from YouTube URLs to extract and process transcripts for integration with Goose CLI or Desktop applications.
Instructions
Retrieves the video information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The URL of the YouTube video |
Implementation Reference
- The MCP tool handler function for 'get_video_info', decorated with @mcp.tool(), which delegates to the _get_video_info helper.@mcp.tool() def get_video_info( ctx: Context[ServerSession, AppContext], url: str = Field(description="The URL of the YouTube video"), ) -> VideoInfo: """Retrieves the video information.""" return _get_video_info(ctx.request_context.lifespan_context, url)
- Cached helper function that performs the core logic of extracting video information using yt_dlp and constructing the VideoInfo object.@lru_cache def _get_video_info(ctx: AppContext, video_url: str) -> VideoInfo: res = ctx.dlp.extract_info(video_url, download=False) upload_date, duration = _parse_time_info(res["upload_date"], res["timestamp"], res["duration"]) return VideoInfo( title=res["title"], description=res["description"], uploader=res["uploader"], upload_date=upload_date, duration=duration, )
- Pydantic BaseModel defining the output schema for the get_video_info tool.class VideoInfo(BaseModel): """Video information.""" title: str = Field(description="Title of the video") description: str = Field(description="Description of the video") uploader: str = Field(description="Uploader of the video") upload_date: AwareDatetime = Field(description="Upload date of the video") duration: str = Field(description="Duration of the video")