update_task
Modify existing task details in Dida365, including title, due date, priority, and tags, by providing the task and project IDs.
Instructions
更新已有任务的信息,如标题、截止日期、优先级等。需要提供 task_id 和 project_id。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | 任务ID | |
| project_id | Yes | 项目ID | |
| title | No | 新标题(可选) | |
| content | No | 新内容(可选) | |
| due_date | No | 新截止日期(可选,ISO 8601格式) | |
| priority | No | 新优先级(0=无, 1=低, 3=中, 5=高) | |
| tags | No | 新标签列表(可选) |
Implementation Reference
- src/dida_mcp/client.py:176-205 (handler)The `update_task` method in the client class, which performs the actual API request to update a task.
def update_task( self, task_id: str, project_id: str, **kwargs ) -> Dict: """ 更新任务 Args: task_id: 任务ID project_id: 项目ID **kwargs: 要更新的字段 """ data: Dict[str, Any] = {"id": task_id, "projectId": project_id} field_map = { "title": "title", "content": "content", "desc": "desc", "start_date": "startDate", "due_date": "dueDate", "priority": "priority", "is_all_day": "isAllDay", "time_zone": "timeZone", "tags": "tags", } for key, api_key in field_map.items(): if key in kwargs and kwargs[key] is not None: data[api_key] = kwargs[key] response = self.client.post(f"/task/{task_id}", json=data) response.raise_for_status() return response.json() - src/dida_mcp/server.py:360-371 (handler)The dispatcher logic in `server.py` that receives the tool call and invokes the client's `update_task` method.
elif name == "update_task": update_fields = { k: v for k, v in args.items() if k not in ("task_id", "project_id") and v is not None } task = client.update_task( task_id=args["task_id"], project_id=args["project_id"], **update_fields, ) return "✅ 任务已更新!\n\n%s" % format_task(task) - src/dida_mcp/server.py:188-214 (schema)MCP tool schema definition for `update_task`.
{ "name": "update_task", "description": "更新已有任务的信息,如标题、截止日期、优先级等。需要提供 task_id 和 project_id。", "inputSchema": { "type": "object", "properties": { "task_id": {"type": "string", "description": "任务ID"}, "project_id": {"type": "string", "description": "项目ID"}, "title": {"type": "string", "description": "新标题(可选)"}, "content": {"type": "string", "description": "新内容(可选)"}, "due_date": { "type": "string", "description": "新截止日期(可选,ISO 8601格式)", }, "priority": { "type": "integer", "description": "新优先级(0=无, 1=低, 3=中, 5=高)", "enum": [0, 1, 3, 5], }, "tags": { "type": "array", "items": {"type": "string"}, "description": "新标签列表(可选)", }, }, "required": ["task_id", "project_id"], },