video_id_parse_tool_wrapper
Extract video details by parsing source and video ID from platforms like TikTok and Kuaishou. Returns status code, message, and video information for efficient data retrieval.
Instructions
根据视频来源和ID解析视频信息
参数:
- source: 视频来源
- video_id: 视频ID
返回:
- code: 状态码
- msg: 状态信息
- data: 视频信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | ||
| video_id | Yes |
Implementation Reference
- yby6_video_mcp_server/server.py:49-51 (handler)Handler function that implements the MCP tool 'video_id_parse_tool_wrapper' by calling the core parsing utility.async def video_id_parse_tool_wrapper(source: str, video_id: str) -> Dict[str, Any]: """根据视频来源和ID解析视频信息""" return await video_id_parse_tool(source, video_id)
- yby6_video_mcp_server/server.py:37-48 (registration)Registration of the 'video_id_parse_tool_wrapper' tool using FastMCP's @mcp.tool decorator, including input/output schema description.@mcp.tool( description=""" 根据视频来源和ID解析视频信息 参数: - source: 视频来源 - video_id: 视频ID 返回: - code: 状态码 - msg: 状态信息 - data: 视频信息 """ )
- Core helper function performing the actual video ID parsing logic using VideoSource and parse_video_id, handling errors and responses.async def video_id_parse_tool(source: str, video_id: str) -> Dict[str, Any]: """根据视频来源和ID解析视频信息""" if not source or not video_id: return create_error_response("视频来源和ID参数不能为空") try: video_source = VideoSource(source) video_info = await parse_video_id(video_source, video_id) logger.info(f"成功解析视频 - 来源: {source}, ID: {video_id}") return create_success_response("解析成功", video_info.__dict__) except ValueError as err: logger.error(f"视频ID解析失败: {err}") return create_error_response(f"无效的视频来源或ID: {str(err)}") except Exception as err: logger.error(f"未知错误: {err}") return create_error_response(f"解析失败: {str(err)}")