Skip to main content
Glama

analyze_video_potential

Analyze YouTube Shorts performance by providing detailed metrics like views and engagement rates to assess video potential.

Instructions

深度分析单个 YouTube Shorts 视频的表现。提供详细的播放量、互动率等核心指标。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
video_urlYesYouTube Shorts 视频链接

Implementation Reference

  • Main handler implementation for analyze_video_potential tool. Extracts video ID, fetches video details from YouTube, gets channel info, analyzes metrics using ViralAnalyzer, and returns a detailed analysis report.
    async def analyze_video_potential(video_url: str) -> list[TextContent]:
        """工具 2 的实现:分析单个视频的爆款潜力"""
        
        try:
            # 提取视频 ID
            video_id = extract_video_id(video_url)
            
            if not video_id:
                return [TextContent(
                    type="text",
                    text=f"❌ 无效的 YouTube 链接: {video_url}\n\n支持的格式:\n- https://www.youtube.com/shorts/VIDEO_ID\n- https://www.youtube.com/watch?v=VIDEO_ID\n- https://youtu.be/VIDEO_ID"
                )]
            
            # 获取视频详情
            client = YouTubeClient()
            videos = client.get_video_details([video_id])
            
            if not videos:
                return [TextContent(
                    type="text",
                    text=f"❌ 未找到视频: {video_id}"
                )]
            
            video = videos[0]
            
            # 获取频道信息
            channel_map = client.get_channel_info([video.channel_id])
            if video.channel_id in channel_map:
                video.channel_subscribers = channel_map[video.channel_id].subscribers
            
            # 分析视频
            analyzer = ViralAnalyzer()
            video = analyzer.analyze_video(video)
            
            # 生成详细报告
            report = analyzer.generate_analysis_report(video)
            
            return [TextContent(type="text", text=report)]
        
        except Exception as e:
            return [TextContent(
                type="text",
                text=f"❌ 分析失败: {str(e)}"
            )]
  • src/server.py:185-201 (registration)
    Tool registration for analyze_video_potential in the list_tools function. Defines tool name, description, and JSON Schema for the required 'video_url' parameter.
    Tool(
        name="analyze_video_potential",
        description=(
            "深度分析单个 YouTube Shorts 视频的表现。"
            "提供详细的播放量、互动率等核心指标。"
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "video_url": {
                    "type": "string",
                    "description": "YouTube Shorts 视频链接"
                }
            },
            "required": ["video_url"]
        }
    ),
  • src/server.py:333-336 (registration)
    Tool routing logic in call_tool handler that routes 'analyze_video_potential' tool calls to the handler function.
    elif name == "analyze_video_potential":
        return await analyze_video_potential(
            video_url=arguments["video_url"]
        )
  • Helper function extract_video_id that parses YouTube URLs to extract the video ID. Supports multiple URL formats (shorts, watch, youtu.be).
    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
  • Helper method generate_analysis_report in ViralAnalyzer that creates a detailed Markdown report with video metrics, engagement rate assessment, and potential evaluation based on views and interaction data.
        def generate_analysis_report(cls, video: VideoData) -> str:
            """
            生成单个视频的详细分析报告
            
            Args:
                video: 视频数据
            
            Returns:
                Markdown 格式的分析报告
            """
            report = f"""
    ## 📊 视频分析报告
    
    **标题**: {video.title}
    **链接**: {video.url}
    
    ### 基础数据
    - **频道**: {video.channel_name}
    - **发布时间**: {video.published_at.strftime('%Y-%m-%d %H:%M UTC')}
    
    ### 核心指标
    - **播放量**: {video.views:,}
    - **点赞数**: {video.likes:,}
    - **评论数**: {video.comments:,}
    - **互动率**: {video.engagement_rate:.2f}%
    
    ### 潜力评估
    """
            
            # 播放量评估
            if video.views >= 1000000:
                report += "- ✅ 播放量超过 100万,属于热门视频\n"
            elif video.views >= 500000:
                report += "- ✅ 播放量超过 50万,表现优秀\n"
            elif video.views >= 100000:
                report += "- ⚠️ 播放量超过 10万,值得关注\n"
            else:
                report += "- ℹ️ 播放量较低\n"
            
            # 互动率评估
            if video.engagement_rate >= 10:
                report += "- ✅ 互动率超过 10%,内容质量极高\n"
            elif video.engagement_rate >= 5:
                report += "- ✅ 互动率超过 5%,内容质量优秀\n"
            elif video.engagement_rate >= 2:
                report += "- ⚠️ 互动率一般,有提升空间\n"
            else:
                report += "- ℹ️ 互动率较低\n"
            
            # 频道影响力(如果有数据)
            if video.channel_subscribers:
                subs = video.channel_subscribers
                views_per_sub = video.views / max(subs, 1)
                report += f"\n### 频道影响力\n"
                report += f"- **订阅数**: {subs:,}\n"
                report += f"- **播放/订阅比**: {views_per_sub:.2f}\n"
                
                if views_per_sub >= 0.5:
                    report += "- ✅ 播放量远超订阅数,内容传播力强\n"
                elif views_per_sub >= 0.1:
                    report += "- ⚠️ 播放量正常,依赖订阅者观看\n"
                else:
                    report += "- ℹ️ 播放量低于预期\n"
            
            return report
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions providing '详细的播放量、互动率等核心指标' (detailed core metrics like view count and engagement rate), which hints at read-only analysis, but doesn't cover aspects like data freshness, rate limits, authentication needs, error handling, or output format. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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 concise and front-loaded, consisting of two clear sentences that state the purpose and key outputs. There's no wasted text, and it efficiently communicates the core function. However, it could be slightly more structured by explicitly separating purpose from output details.

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 tool's complexity (analyzing video performance), lack of annotations, and no output schema, the description is incomplete. It mentions metrics but doesn't detail the return structure, data sources, or limitations. For a tool that likely involves data retrieval and analysis, more context on behavior and outputs is needed to be fully helpful to an AI agent.

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%, with the single parameter 'video_url' well-documented in the schema as 'YouTube Shorts 视频链接' (YouTube Shorts video link). The description adds no additional meaning beyond this, such as URL format examples or constraints. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 视频的表现' (deeply analyze the performance of a single YouTube Shorts video). It specifies the verb '分析' (analyze) and resource 'YouTube Shorts 视频' (YouTube Shorts video), though it doesn't explicitly differentiate from sibling tools like 'summarize_video_story' or 'get_youtube_shorts_trends' which might have overlapping domains.

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 '单个' (single) videos, but doesn't specify contexts like performance evaluation, content strategy, or comparison with other tools. With siblings like 'get_youtube_shorts_trends' (likely for trends) and 'summarize_video_story' (likely for content), there's no explicit when/when-not or alternative recommendations.

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