create_task
Add a new task to a project in Clockify by specifying workspace ID, project ID, and task name. Optionally include assignees, time estimates, and task status for better project organization.
Instructions
Create a new task in a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assigneeIds | No | Array of assignee user IDs (optional) | |
| estimate | No | Task estimate (ISO 8601 duration, optional) | |
| name | Yes | Task name | |
| projectId | Yes | Project ID | |
| status | No | Task status (optional) | |
| workspaceId | Yes | Workspace ID |
Implementation Reference
- src/index.ts:1134-1152 (handler)The main handler function for the 'create_task' tool. It extracts parameters from args, makes a POST request to the Clockify API endpoint `/workspaces/{workspaceId}/projects/{projectId}/tasks` with the task data, and returns a success message with the created task details.private async createTask(args: any) { const { workspaceId, projectId, ...taskData } = args; const task = await this.makeRequest( `/workspaces/${workspaceId}/projects/${projectId}/tasks`, "POST", taskData ); return { content: [ { type: "text", text: `Task created successfully!\nID: ${task.id}\nName: ${task.name}\nProject: ${projectId}\nStatus: ${task.status}\nEstimate: ${task.estimate || "No estimate"}`, }, ], isError: false, }; }
- src/index.ts:478-487 (schema)Input schema definition for the 'create_task' tool, specifying the required and optional parameters with their types and descriptions.type: "object", properties: { workspaceId: { type: "string", description: "Workspace ID" }, projectId: { type: "string", description: "Project ID" }, name: { type: "string", description: "Task name" }, assigneeIds: { type: "array", items: { type: "string" }, description: "Array of assignee user IDs (optional)" }, estimate: { type: "string", description: "Task estimate (ISO 8601 duration, optional)" }, status: { type: "string", enum: ["ACTIVE", "DONE"], description: "Task status (optional)" }, }, required: ["workspaceId", "projectId", "name"],
- src/index.ts:475-489 (registration)Registration of the 'create_task' tool in the server's tool list returned by ListToolsRequestSchema, including name, description, and input schema.name: "create_task", description: "Create a new task in a project", inputSchema: { type: "object", properties: { workspaceId: { type: "string", description: "Workspace ID" }, projectId: { type: "string", description: "Project ID" }, name: { type: "string", description: "Task name" }, assigneeIds: { type: "array", items: { type: "string" }, description: "Array of assignee user IDs (optional)" }, estimate: { type: "string", description: "Task estimate (ISO 8601 duration, optional)" }, status: { type: "string", enum: ["ACTIVE", "DONE"], description: "Task status (optional)" }, }, required: ["workspaceId", "projectId", "name"], }, },
- src/index.ts:768-770 (registration)Dispatch case in the CallToolRequestSchema handler that validates parameters and invokes the createTask method.case "create_task": if (!args?.workspaceId || !args?.projectId) throw new McpError(ErrorCode.InvalidParams, 'workspaceId and projectId are required'); return await this.createTask(args as any);
- src/index.ts:42-49 (helper)TypeScript interface defining the structure of a Task object, used for type safety in task-related operations.interface Task { id?: string; name: string; projectId: string; assigneeIds?: string[]; estimate?: string; status?: "ACTIVE" | "DONE"; }