Skip to main content
Glama

summarize_video_story

Extract story summaries and key content from YouTube Shorts videos by analyzing titles, descriptions, themes, and narrative techniques.

Instructions

提炼 YouTube Shorts 视频的故事梗概和核心内容。基于视频标题和描述,分析视频的主题、情节和创作手法。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
video_urlYesYouTube Shorts 视频链接

Implementation Reference

  • Main handler function for summarize_video_story tool. Extracts video ID, fetches video details via YouTubeClient, and formats the video information (title, channel, stats, description) into a structured text response for Claude to analyze and summarize.
    async def summarize_video_story(video_url: str) -> list[TextContent]:
        """
        工具 4 的实现:提炼视频故事梗概
        
        这个工具的巧妙之处:
        1. 我们只负责获取视频的标题和描述
        2. 将这些信息返回给 Claude
        3. Claude 会自动分析并提炼故事梗概
        4. 用户看到的是 Claude 基于视频信息生成的分析
        """
        
        try:
            # 提取视频 ID
            video_id = extract_video_id(video_url)
            
            if not video_id:
                return [TextContent(
                    type="text",
                    text=f"❌ 无效的 YouTube 链接: {video_url}"
                )]
            
            # 获取视频详情
            client = YouTubeClient()
            videos = client.get_video_details([video_id])
            
            if not videos:
                return [TextContent(
                    type="text",
                    text=f"❌ 未找到视频: {video_id}"
                )]
            
            video = videos[0]
            
            # 构建视频信息文本,供 Claude 分析
            info = f"""# 视频信息
    
    **标题**: {video.title}
    
    **频道**: {video.channel_name}
    
    **发布时间**: {video.published_at.strftime('%Y-%m-%d %H:%M UTC')}
    
    **播放量**: {video.views:,}
    
    **点赞数**: {video.likes:,}
    
    **评论数**: {video.comments:,}
    
    **视频链接**: {video.url}
    
    ---
    
    ## 视频描述
    
    {video.description if video.description else '(该视频没有描述)'}
    
    ---
    
    **请基于以上信息,分析这个视频的:**
    1. 主题和核心内容
    2. 可能的故事情节或创作手法
    3. 为什么这个视频可能受欢迎
    4. 适合什么样的观众群体
    """
            
            return [TextContent(type="text", text=info)]
        
        except Exception as e:
            return [TextContent(
                type="text",
                text=f"❌ 获取视频信息失败: {str(e)}"
            )]
  • src/server.py:235-251 (registration)
    Tool registration in list_tools() function. Defines the tool name 'summarize_video_story', description for Claude, and the inputSchema requiring a 'video_url' parameter.
    Tool(
        name="summarize_video_story",
        description=(
            "提炼 YouTube Shorts 视频的故事梗概和核心内容。"
            "基于视频标题和描述,分析视频的主题、情节和创作手法。"
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "video_url": {
                    "type": "string",
                    "description": "YouTube Shorts 视频链接"
                }
            },
            "required": ["video_url"]
        }
    ),
  • src/server.py:344-347 (registration)
    Call routing in call_tool() function. Routes tool calls with name='summarize_video_story' to the summarize_video_story handler function, passing the video_url argument.
    elif name == "summarize_video_story":
        return await summarize_video_story(
            video_url=arguments["video_url"]
        )
  • Helper function extract_video_id() used by summarize_video_story to parse YouTube URLs and extract the video ID using regex patterns for different YouTube URL formats.
    def extract_video_id(url: str) -> Optional[str]:
        """从 YouTube URL 中提取视频 ID"""
        patterns = [
            r'youtube\.com/shorts/([a-zA-Z0-9_-]+)',
            r'youtube\.com/watch\?v=([a-zA-Z0-9_-]+)',
            r'youtu\.be/([a-zA-Z0-9_-]+)',
        ]
        
        for pattern in patterns:
            match = re.search(pattern, url)
            if match:
                return match.group(1)
        
        return None
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool analyzes video content based on title and description, implying a read-only operation that doesn't modify data. However, it lacks details on rate limits, authentication needs, output format, error handling, or whether it accesses external APIs. For a tool with no annotation coverage, this is a significant gap in transparency about how it behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two sentences that directly state the tool's function and analysis scope. It's front-loaded with the core purpose and avoids unnecessary details. However, it could be slightly more structured by explicitly separating the 'what' from the 'how' (e.g., clarifying it's for narrative analysis only), but it's efficient with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (analyzing video content narratively), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the output looks like (e.g., structured summary, key points list), potential limitations (e.g., language support, video length constraints), or error cases. For a tool with no structured behavioral or output data, the description should provide more context to be fully helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100% (the 'video_url' parameter is fully described in the schema as 'YouTube Shorts 视频链接'), so the baseline is 3. The description adds no additional parameter semantics beyond what's in the schema—it doesn't specify URL format requirements, validation rules, or examples. It merely reiterates the tool's purpose without enhancing parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '提炼 YouTube Shorts 视频的故事梗概和核心内容' (summarize the story outline and core content of YouTube Shorts videos) and specifies it analyzes '主题、情节和创作手法' (theme, plot, and creative techniques). It distinguishes from siblings like 'analyze_video_potential' or 'get_trending_topics' by focusing on narrative analysis rather than trend discovery or potential assessment. However, it doesn't explicitly contrast with all siblings, preventing a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions analyzing 'YouTube Shorts' videos specifically, but doesn't clarify if it's for short-form content only, how it differs from 'analyze_video_potential' (which might assess virality or engagement), or when to choose it over trend-related siblings. There's an implied context (video analysis) but no explicit usage rules or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/Xeron2000/viral-shorts'

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