Skip to main content
Glama

get_summary

Summarize YouTube videos by extracting key points from transcripts. Customize output length and language for quick insights. Ideal for saving time and understanding content efficiently.

Instructions

Generate a summary of a YouTube video

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
languageNoen
lengthNomedium
urlYes

Implementation Reference

  • Registration of the get_summary tool using the mcp_server.tool decorator.
    @mcp_server.tool(name="get_summary", description="Generate a summary of a YouTube video")
  • The main handler function implementing the get_summary tool logic: validates length, processes video, fetches summary via API with polling support, handles errors and returns the summary or error message.
    async def get_summary(url: str, language: str = "en", length: str = "medium") -> str: """Generate a summary of a YouTube video. This tool processes a video and generates a summary of its content in the specified language. It properly handles "processing" states by polling until completion rather than failing immediately. If the requested language is not available, it automatically requests a translation first. Args: url: The YouTube video URL language: Language code for the summary (e.g., "en", "fr") length: Length of the summary ("short", "medium", or "long") Returns: A summary of the video content """ logger.info(f"Getting summary for URL: {url}, language: {language}, length: {length}") # Validate length if length not in ["short", "medium", "long"]: error_msg = f"Invalid length: {length}. Must be 'short', 'medium', or 'long'." logger.error(error_msg) return f"Error: {error_msg}" # Process the video to ensure it's ready success, video_id, error_message = await process_video(url) if not success: logger.error(f"Failed to process video: {error_message}") return f"Error: {error_message}" # Get the summary from the API summary_response = await make_yt_api_request( f"/api/videos/{video_id}/summary", params={"language": language, "length": length} ) if not summary_response: error_msg = f"Failed to retrieve summary for language: {language}, length: {length}" logger.error(error_msg) return f"Error: {error_msg}" # Check if the response is a JSON object with the summary if isinstance(summary_response, dict) and "summary" in summary_response: return summary_response["summary"] elif isinstance(summary_response, dict) and "error" in summary_response: error_msg = summary_response["error"] logger.error(f"API error: {error_msg}") return f"Error: {error_msg}" else: error_msg = "Unexpected response format from API." logger.error(error_msg) return f"Error: {error_msg}"
  • Type annotations defining the input schema (url: str required, language: str="en", length: str="medium") and output str.
    async def get_summary(url: str, language: str = "en", length: str = "medium") -> str:

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/brianshin22/youtube-translate-mcp'

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