# 创建任务(+create) > ⚠️ 参数细节以 MCP `task_create` 的 docstring 为准,本文档仅做工作流引导。 ## 必填信息收集 在调用 `task_create` 前,引导用户提供: | 字段 | 必填 | 说明 | |------|------|------| | `module_id` | ✅ | 所属模块 UUID(从缓存解析名字 → ID) | | `title` | ✅ | 任务标题(简洁明了)| | `description` | 可选 | 任务详情、背景、验收标准(Markdown) | | `end_date` | 可选 | 截止日期(YYYY-MM-DD 格式,**字段名是 end_date,不是 due_date**) | | `priority` | 可选 | `low` / `medium` / `high` / `critical`,默认 `medium`(**没有 urgent**) | | `status` | 可选 | `not_started`(默认)/ `in_progress` | | `parent_task_id` | 可选 | 父任务 UUID,传此字段即为子任务 | | `assignee_ids` | 可选 | 执行人 user_id 列表,**可在创建时一并传入**(无需再单独调 `task_set_assignees`) | --- ## 执行步骤 ``` Step 1: 解析模块名 → module_id → Read ~/.claude/huanxi-cache/modules.json → 模糊匹配模块名(详见 huanxi-org resolve-ids.md) Step 2: [若用户提到执行人] 解析人名 → user_id(user 对象的 id 字段) → Read ~/.claude/huanxi-cache/users.json → 未命中 → mcp__huanxi__user_list(name=<人名>) → 追加写缓存 Step 3: 创建任务(推荐一次性把执行人也带上) → mcp__huanxi__task_create( module_id = "<模块ID>", title = "任务标题", description = "...", ← 可选 end_date = "YYYY-MM-DD", ← 可选;字段名 end_date priority = "medium", ← 可选;low/medium/high/critical status = "not_started", ← 可选;默认 not_started assignee_ids = [""] ← 可选;若 Step 2 有解析到,建议一并传入 ) → 返回:task_id Step 4: [仅当 Step 3 未传 assignee_ids 时] 单独设置执行人 → mcp__huanxi__task_set_assignees( task_id = "<刚创建的 task_id>", assignee_ids = [""] ) Step 5: 告知创建结果 → 展示:任务标题、所属模块、执行人、截止日、task_id → 询问:"是否需要进一步调整?" ``` --- ## 权限说明 用户必须是所属模块的成员(任意角色)才能创建任务。若返回 403: - 可能未加入该模块 - 建议联系模块负责人添加成员,或请管理员使用 Admin MCP 操作 --- ## 子任务支持 若需创建子任务: ``` mcp__huanxi__task_create( module_id = "<模块ID>", title = "子任务标题", parent_task_id = "<父任务ID>" ← 传此字段即为子任务 ) ``` --- ## 字段名速查(避免漂移) | 概念 | 正确字段名 | 错误写法 | |------|----------|---------| | 截止日期 | `end_date` | ~~due_date~~ | | 紧急优先级 | `critical` | ~~urgent~~ | | 未开始状态 | `not_started` | ~~todo~~ | | 父任务 ID | `parent_task_id` | ~~parent_id~~(后端 body 内是 parent_id,但 MCP 参数是 parent_task_id) |