create-task
Create new tasks in Sunsama with title, notes, due dates, time estimates, and stream assignments to organize your workflow.
Instructions
Create a new task with optional properties
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dueDate | No | Due date string (ISO format) | |
| notes | No | Additional task notes | |
| private | No | Whether the task is private | |
| snoozeUntil | No | Snooze until date string (ISO format) - the date the task is scheduled for | |
| streamIds | No | Array of stream IDs to associate with the task | |
| taskId | No | Custom task ID (auto-generated if not provided) | |
| text | Yes | Task title/description | |
| timeEstimate | No | Time estimate in minutes |
Implementation Reference
- src/tools/task-tools.ts:119-157 (handler)The main handler implementation for the 'create-task' tool. It wraps withTransportClient, defines parameters via createTaskSchema, and executes task creation via the client.export const createTaskTool = withTransportClient({ name: "create-task", description: "Create a new task with optional properties", parameters: createTaskSchema, execute: async ( { text, notes, streamIds, timeEstimate, dueDate, snoozeUntil, private: isPrivate, taskId, integration, }: CreateTaskInput, context: ToolContext, ) => { const options: CreateTaskOptions = {}; if (notes) options.notes = notes; if (streamIds) options.streamIds = streamIds; if (timeEstimate) options.timeEstimate = timeEstimate; if (dueDate) options.dueDate = dueDate; if (snoozeUntil) options.snoozeUntil = snoozeUntil; if (isPrivate !== undefined) options.private = isPrivate; if (taskId) options.taskId = taskId; if (integration) options.integration = integration; const result = await context.client.createTask(text, options); return formatJsonResponse({ success: result.success, taskId: result.updatedFields?._id, title: text, created: true, updatedFields: result.updatedFields, }); }, });
- src/schemas.ts:111-133 (schema)Input schema validation for the create-task tool using Zod, defining all parameters with descriptions and constraints.export const createTaskSchema = z.object({ text: z.string().min(1, "Task text is required").describe( "Task title/description", ), notes: z.string().optional().describe("Additional task notes"), streamIds: z.array(z.string()).optional().describe( "Array of stream IDs to associate with the task", ), timeEstimate: z.number().int().positive().optional().describe( "Time estimate in minutes", ), dueDate: z.string().optional().describe("Due date string (ISO format)"), snoozeUntil: z.string().optional().describe( "Snooze until date string (ISO format) - the date the task is scheduled for", ), private: z.boolean().optional().describe("Whether the task is private"), taskId: z.string().optional().describe( "Custom task ID (auto-generated if not provided)", ), integration: taskIntegrationSchema.optional().describe( "Integration information for linking task to external services (GitHub, Gmail, etc.)", ), });
- src/main.ts:33-44 (registration)Final registration of the create-task tool (via allTools) with the MCP server using server.registerTool.allTools.forEach((tool) => { server.registerTool( tool.name, { description: tool.description, inputSchema: "shape" in tool.parameters ? tool.parameters.shape : tool.parameters, }, tool.execute, ); });
- src/tools/task-tools.ts:406-426 (registration)The taskTools array that includes the createTaskTool for grouping task-related tools.export const taskTools = [ // Query tools getTasksBacklogTool, getTasksByDayTool, getArchivedTasksTool, getTaskByIdTool, // Lifecycle tools createTaskTool, deleteTaskTool, // Update tools updateTaskCompleteTool, updateTaskSnoozeDateTool, updateTaskBacklogTool, updateTaskPlannedTimeTool, updateTaskNotesTool, updateTaskDueDateTool, updateTaskTextTool, updateTaskStreamTool, ];
- src/tools/index.ts:5-9 (registration)Aggregation of all tools into allTools array, spreading taskTools which includes create-task.export const allTools = [ ...userTools, ...taskTools, ...streamTools, ];