Skip to main content
Glama

gen_video

Generate educational explanation videos from text questions and answers, with optional image support, to create instructional content for learning purposes.

Instructions

生成教学讲解视频,生成时间大约需要10到20分钟,根据题目难度来定

Args: question: 问题内容(文本形式),question和questionImages中至少输入一个 answer: 参考答案(文本形式):确保生成的讲解内容准确(可选) question_images: 问题内容(图片形式),输入图片的URL或者base64(可选) answer_images: 参考答案(图片形式),输入图片的URL或者base64(可选) quality: 视频质量,可选值:l(低)、m(中)、h(高),默认为配置的默认质量

Returns: 包含任务ID的字典

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
questionNo
answerNo
question_imagesNo
answer_imagesNo
qualityNom

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Primary MCP tool handler for 'gen_video'. This function is registered via @mcp.tool() decorator, validates inputs, retrieves API key from HTTP headers, and proxies the video generation request to the external Scenext API (https://api.scenext.cn/api/gen_video), returning task ID on success.
    @mcp.tool()
    async def gen_video(
        question: str = "",
        answer: str = "",
        question_images: Optional[List[str]] = None,
        answer_images: Optional[List[str]] = None,
        quality: str = DEFAULT_QUALITY
    ) -> Dict[str, Any]:
        """
        生成教学讲解视频,生成时间大约需要10到20分钟,根据题目难度来定
        
        Args:
            question: 问题内容(文本形式),question和questionImages中至少输入一个
            answer: 参考答案(文本形式):确保生成的讲解内容准确(可选)
            question_images: 问题内容(图片形式),输入图片的URL或者base64(可选)
            answer_images: 参考答案(图片形式),输入图片的URL或者base64(可选)
            quality: 视频质量,可选值:l(低)、m(中)、h(高),默认为配置的默认质量
        
        Returns:
            包含任务ID的字典
        """
        
        # 从请求头获取API KEY
        api_key = get_api_key_from_headers()
        
        if not api_key or api_key == "YOUR_API_KEY":
            return {"error": "请在请求头中提供有效的API Key,支持Authorization: Bearer <token>或X-API-Key: <token>"}
        
        # 验证至少有question或questionImages其中一个
        if not question.strip() and not (question_images and len(question_images) > 0):
            return {"error": "question和questionImages中至少输入一个"}
        
        url = f"{API_BASE_URL}/gen_video"
        headers = {
            "Authorization": f"Bearer {api_key}",
            "Content-Type": "application/json"
        }
    
        data = {
            "question": question,
            "answer": answer,
            "questionImages": question_images or [],
            "answerImages": answer_images or [],
            "quality": quality,
        }
    
        try:
            async with aiohttp.ClientSession() as session:
                async with session.post(url, json=data, headers=headers) as response:
                    if response.status == 200:
                        result = await response.json()
                        logger.info(f"视频生成请求成功: {result}")
                        
                        if result.get("status") == "success":
                            return {
                                "status": "success",
                                "task_id": result.get("data", {}).get("task_id"),
                                "message": "视频生成任务创建成功"
                            }
                        else:
                            return {
                                "error": "API返回错误状态",
                                "details": result
                            }
                    else:
                        error_text = await response.text()
                        logger.error(f"API请求失败: {response.status} - {error_text}")
                        return {
                            "error": f"API请求失败: {response.status}",
                            "details": error_text
                        }
        except aiohttp.ClientError as e:
            logger.error(f"网络请求错误: {e}")
            return {"error": f"网络请求错误: {str(e)}"}
        except Exception as e:
            logger.error(f"未知错误: {e}")
            return {"error": f"未知错误: {str(e)}"}
  • Registration of the gen_video tool using FastMCP's @mcp.tool() decorator.
    @mcp.tool()
  • Input schema defined by function parameters with type hints and detailed docstring describing arguments and return value.
    async def gen_video(
        question: str = "",
        answer: str = "",
        question_images: Optional[List[str]] = None,
        answer_images: Optional[List[str]] = None,
        quality: str = DEFAULT_QUALITY
    ) -> Dict[str, Any]:
        """
        生成教学讲解视频,生成时间大约需要10到20分钟,根据题目难度来定
        
        Args:
            question: 问题内容(文本形式),question和questionImages中至少输入一个
            answer: 参考答案(文本形式):确保生成的讲解内容准确(可选)
            question_images: 问题内容(图片形式),输入图片的URL或者base64(可选)
            answer_images: 参考答案(图片形式),输入图片的URL或者base64(可选)
            quality: 视频质量,可选值:l(低)、m(中)、h(高),默认为配置的默认质量
        
        Returns:
            包含任务ID的字典
Behavior3/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 reveals the generation time (10-20 minutes depending on question difficulty), which is valuable operational context. However, it doesn't mention authentication needs, rate limits, error conditions, or what happens during processing. The description doesn't contradict annotations (none exist), but provides only basic behavioral information.

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

Conciseness3/5

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

The description is reasonably concise but not optimally structured. The first sentence states the purpose, followed by time estimate, then parameter explanations in a separate 'Args' section, and finally return information. While not excessively verbose, the mixing of languages (Chinese purpose/English parameter labels) and the separation of parameter details from the main description could be more integrated. Every sentence adds value but the organization could be improved.

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

Completeness3/5

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

Given the tool's complexity (video generation with 5 parameters, no annotations, but with output schema), the description is moderately complete. The output schema existence means return values don't need explanation in the description. However, for a generative tool with significant processing time and multiple input options, the description should provide more context about error handling, format requirements, and usage scenarios. It covers basics but leaves important gaps.

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

Parameters2/5

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

With 0% schema description coverage and 5 parameters, the description must compensate but does so inadequately. It explains that 'question' and 'question_images' require at least one input, clarifies 'answer' helps ensure accuracy, and lists quality options. However, it doesn't explain parameter interactions, format requirements (e.g., what constitutes valid URLs/base64), or the significance of defaults. The description adds some meaning but leaves many parameter details unclear.

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: '生成教学讲解视频' (generate instructional explanation videos). It specifies the domain (educational) and output type (video), though it doesn't explicitly differentiate from the sibling tool 'query_video_status' beyond their different functions. The verb '生成' (generate) is specific and the resource '教学讲解视频' (instructional explanation video) is well-defined.

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. While it mentions the sibling tool 'query_video_status' exists, there's no explicit comparison or context about when to choose one over the other. The only usage hint is the time estimate (10-20 minutes), but no when/when-not criteria or prerequisites are stated.

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/typing233/scenext-mcp'

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