Skip to main content
Glama

create_draft

Create a new video editing project draft in JianYing (CapCut) with customizable resolution and frame rate settings for professional video production workflows.

Instructions

创建草稿

Args: draft_name: str 草稿名称 width: int,视频宽度,默认1920 height: int,视频高度,默认1080 fps: int,帧率,默认30

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
draft_nameYes
widthNo
heightNo
fpsNo

Implementation Reference

  • The handler function for the 'create_draft' MCP tool. It is decorated with @mcp.tool() and implements the creation of a new draft by generating a UUID, creating a directory, saving draft.json, updating index, and returning draft data.
    @mcp.tool()
    def create_draft(draft_name: str, width: int = 1920, height: int = 1080, fps: int = 30):
        """
        创建草稿
    
        Args:
            draft_name:  str 草稿名称
            width: int,视频宽度,默认1920
            height: int,视频高度,默认1080
            fps: int,帧率,默认30
        """
        # 验证SAVE_PATH是否存在
        if not os.path.exists(SAVE_PATH):
            raise FileNotFoundError(f"草稿存储路径不存在: {SAVE_PATH}")
        # 生成草稿ID
        draft_id = str(uuid.uuid4())
        # 构建完整的草稿路径
        draft_path = os.path.join(SAVE_PATH, draft_id)
        # 创建草稿数据
        draft_data = {
            "draft_id": draft_id,
            "draft_name": draft_name,
            "width": width,
            "height": height,
            "fps": fps
        }
        # 在SAVE_PATH下创建以草稿ID命名的文件夹
        os.makedirs(draft_path, exist_ok=True)
    
        # 保存draft.json文件
        draft_json_path = os.path.join(draft_path, "draft.json")
        with open(draft_json_path, "w", encoding="utf-8") as f:
            json.dump(draft_data, f, ensure_ascii=False, indent=4)
    
        # 添加草稿索引记录
    
        draft_info = {
            "draft_name": draft_name,
            "created_time": datetime.datetime.now().isoformat(),
            "width": width,
            "height": height,
            "fps": fps
        }
        index_manager.add_draft_mapping(draft_id, draft_info)
    
        return draft_data
  • Registers the draft-related tools, including 'create_draft', by invoking draft_tools(mcp) in the MCP server main function.
    draft_tools(mcp)

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/hey-jian-wei/jianying-mcp'

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