Skip to main content
Glama
robertn702

Sunsama MCP Server

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
NameRequiredDescriptionDefault
dueDateNoDue date string (ISO format)
notesNoAdditional task notes
privateNoWhether the task is private
snoozeUntilNoSnooze until date string (ISO format) - the date the task is scheduled for
streamIdsNoArray of stream IDs to associate with the task
taskIdNoCustom task ID (auto-generated if not provided)
textYesTask title/description
timeEstimateNoTime estimate in minutes

Implementation Reference

  • 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,
        });
      },
    });
  • 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,
      );
    });
  • 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,
    ];

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/robertn702/mcp-sunsama'

If you have feedback or need assistance with the MCP directory API, please join our Discord server