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
| Name | Required | Description | Default |
|---|---|---|---|
| draft_name | Yes | ||
| width | No | ||
| height | No | ||
| fps | No |
Implementation Reference
- jianyingdraft/tool/draft_tool.py:69-114 (handler)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
- jianyingdraft/server.py:26-26 (registration)Registers the draft-related tools, including 'create_draft', by invoking draft_tools(mcp) in the MCP server main function.draft_tools(mcp)