create_task
Add new tasks to Dida365 with title, project assignment, due dates, priority levels, and detailed descriptions for organized task management.
Instructions
Create a new task in Dida365 with specified details including title, project ID, content, due date and priority. The task will be created under the specified project. Requires at least title and projectId. Returns the created task details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | The title/name of the task (required) | |
| projectId | Yes | The ID of the project where this task belongs (required) | |
| content | No | Detailed description/content of the task | |
| dueDate | No | Due date in ISO 8601 format (e.g., 2023-12-31T23:59:59Z) | |
| priority | No | Priority level from 0 (none) to 5 (highest) |
Implementation Reference
- src/index.ts:354-374 (handler)The handler function for the 'create_task' tool. It constructs a Task object from the input parameters (title, projectId required; content, dueDate, priority optional), sends a POST request to the Dida365 API endpoint '/task', and returns the response detailing the created task.case "create_task": { const task: Task = { title: args.title as string, projectId: args.projectId as string, }; if (args.content) task.content = args.content as string; if (args.dueDate) task.dueDate = args.dueDate as string; if (args.priority !== undefined) task.priority = args.priority as number; const response: AxiosResponse = await dida365Api.post("/task", task); return { content: [ { type: "text", text: `任务创建成功: ${JSON.stringify(response.data, null, 2)}`, }, ], }; }
- src/index.ts:111-136 (schema)Input schema definition for the 'create_task' tool, specifying the JSON object structure with required 'title' and 'projectId' fields, and optional 'content', 'dueDate', and 'priority' fields.inputSchema: { type: "object", properties: { title: { type: "string", description: "The title/name of the task (required)", }, projectId: { type: "string", description: "The ID of the project where this task belongs (required)", }, content: { type: "string", description: "Detailed description/content of the task", }, dueDate: { type: "string", description: "Due date in ISO 8601 format (e.g., 2023-12-31T23:59:59Z)", }, priority: { type: "number", description: "Priority level from 0 (none) to 5 (highest)", }, }, required: ["title", "projectId"], },
- src/index.ts:108-137 (registration)Registration of the 'create_task' tool in the ListTools response handler. Includes the tool name, description, and input schema.{ name: "create_task", description: "Create a new task in Dida365 with specified details including title, project ID, content, due date and priority. The task will be created under the specified project. Requires at least title and projectId. Returns the created task details.", inputSchema: { type: "object", properties: { title: { type: "string", description: "The title/name of the task (required)", }, projectId: { type: "string", description: "The ID of the project where this task belongs (required)", }, content: { type: "string", description: "Detailed description/content of the task", }, dueDate: { type: "string", description: "Due date in ISO 8601 format (e.g., 2023-12-31T23:59:59Z)", }, priority: { type: "number", description: "Priority level from 0 (none) to 5 (highest)", }, }, required: ["title", "projectId"], }, },
- src/index.ts:47-64 (helper)TypeScript interface defining the structure of a Task object, used in the create_task handler for type safety.interface Task { id?: string; // Task identifier projectId?: string; // Task project id title?: string; // Task title isAllDay?: boolean; // All day completedTime?: string; // Task completed time in "yyyy-MM-dd'T'HH:mm:ssZ" content?: string; // Task content desc?: string; // Task description of checklist dueDate?: string; // Task due date time in "yyyy-MM-dd'T'HH:mm:ssZ" items?: ChecklistItem[]; // Subtasks of Task priority?: 0 | 1 | 3 | 5 | number; // Task priority: None:0, Low:1, Medium:3, High:5 reminders?: string[]; // List of reminder triggers repeatFlag?: string; // Recurring rules of task sortOrder?: number; // Task sort order startDate?: string; // Start date time in "yyyy-MM-dd'T'HH:mm:ssZ" status?: 0 | 2 | number; // Task completion status: Normal: 0, Completed: 2 timeZone?: string; // Task timezone }