Skip to main content
Glama
robertn702

Sunsama MCP Server

get-tasks-backlog

Retrieve all pending tasks from your backlog to review and organize upcoming work items in Sunsama.

Instructions

Get tasks from the backlog

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Defines the main handler for the 'get-tasks-backlog' tool using withTransportClient wrapper. Fetches tasks from the client's backlog method, trims them, and formats as TSV response.
    export const getTasksBacklogTool = withTransportClient({
      name: "get-tasks-backlog",
      description: "Get tasks from the backlog",
      parameters: getTasksBacklogSchema,
      execute: async (_args: GetTasksBacklogInput, context: ToolContext) => {
        const tasks = await context.client.getTasksBacklog();
        const trimmedTasks = trimTasksForResponse(tasks);
    
        return formatTsvResponse(trimmedTasks);
      },
    });
  • Defines the Zod input schema for the tool, which accepts no parameters (empty object).
    export const getTasksBacklogSchema = z.object({});
  • src/main.ts:32-44 (registration)
    Registers all tools, including 'get-tasks-backlog', with the MCP server by iterating over allTools and calling server.registerTool for each.
    // Register all tools
    allTools.forEach((tool) => {
      server.registerTool(
        tool.name,
        {
          description: tool.description,
          inputSchema: "shape" in tool.parameters
            ? tool.parameters.shape
            : tool.parameters,
        },
        tool.execute,
      );
    });
  • src/tools/index.ts:5-9 (registration)
    Assembles allTools array by combining userTools, taskTools (which includes getTasksBacklogTool), and streamTools for registration in main.ts.
    export const allTools = [
      ...userTools,
      ...taskTools,
      ...streamTools,
    ];
  • Includes getTasksBacklogTool in the taskTools array, which is then spread into allTools for server registration.
    });
    
    export const getTasksByDayTool = withTransportClient({
      name: "get-tasks-by-day",
      description:
        "Get tasks for a specific day with optional filtering by completion status",
      parameters: getTasksByDaySchema,
      execute: async (
        { day, timezone, completionFilter = "all" }: GetTasksByDayInput,
        context: ToolContext,
      ) => {
        // If no timezone provided, get the user's default timezone
        let resolvedTimezone = timezone;
        if (!resolvedTimezone) {
          resolvedTimezone = await context.client.getUserTimezone();
        }
    
        const tasks = await context.client.getTasksByDay(day, resolvedTimezone);
        const filteredTasks = filterTasksByCompletion(tasks, completionFilter);
        const trimmedTasks = trimTasksForResponse(filteredTasks);
    
        return formatTsvResponse(trimmedTasks);
      },
    });
    
    export const getArchivedTasksTool = withTransportClient({
      name: "get-archived-tasks",
      description: "Get archived tasks with optional pagination",
      parameters: getArchivedTasksSchema,
      execute: async (
        { offset = 0, limit = 100 }: GetArchivedTasksInput,
        context: ToolContext,
      ) => {
        const requestedLimit = limit;
        const fetchLimit = requestedLimit + 1;
    
        const allTasks = await context.client.getArchivedTasks(offset, fetchLimit);
    
        const hasMore = allTasks.length > requestedLimit;
        const tasks = hasMore ? allTasks.slice(0, requestedLimit) : allTasks;
        const trimmedTasks = trimTasksForResponse(tasks);
    
        const paginationInfo = {
          offset,
          limit: requestedLimit,
          count: tasks.length,
          hasMore,
          nextOffset: hasMore ? offset + requestedLimit : null,
        };
    
        return formatPaginatedTsvResponse(trimmedTasks, paginationInfo);
      },
    });
    
    export const getTaskByIdTool = withTransportClient({
      name: "get-task-by-id",
      description: "Get a specific task by its ID",
      parameters: getTaskByIdSchema,
      execute: async ({ taskId }: GetTaskByIdInput, context: ToolContext) => {
        const task = await context.client.getTaskById(taskId) || null;
    
        return formatJsonResponse(task);
      },
    });
    
    // Task Lifecycle Tools
    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,
        });
      },
    });
    
    export const deleteTaskTool = withTransportClient({
      name: "delete-task",
      description: "Delete a task permanently",
      parameters: deleteTaskSchema,
      execute: async (
        { taskId, limitResponsePayload, wasTaskMerged }: DeleteTaskInput,
        context: ToolContext,
      ) => {
        const result = await context.client.deleteTask(
          taskId,
          limitResponsePayload,
          wasTaskMerged,
        );
    
        return formatJsonResponse({
          success: result.success,
          taskId,
          deleted: true,
          updatedFields: result.updatedFields,
        });
      },
    });
    
    // Task Update Tools
    export const updateTaskCompleteTool = withTransportClient({
      name: "update-task-complete",
      description: "Mark a task as complete with optional completion timestamp",
      parameters: updateTaskCompleteSchema,
      execute: async (
        { taskId, completeOn, limitResponsePayload }: UpdateTaskCompleteInput,
        context: ToolContext,
      ) => {
        const result = await context.client.updateTaskComplete(
          taskId,
          completeOn,
          limitResponsePayload,
        );
    
        return formatJsonResponse({
          success: result.success,
          taskId,
          completed: true,
          updatedFields: result.updatedFields,
        });
      },
    });
    
    export const updateTaskSnoozeDateTool = withTransportClient({
      name: "update-task-snooze-date",
      description:
        "Update task snooze date to reschedule tasks or move them to backlog",
      parameters: updateTaskSnoozeDateSchema,
      execute: async (
        { taskId, newDay, timezone, limitResponsePayload }:
          UpdateTaskSnoozeDateInput,
        context: ToolContext,
      ) => {
        const options: { timezone?: string; limitResponsePayload?: boolean } = {};
        if (timezone) options.timezone = timezone;
        if (limitResponsePayload !== undefined) {
          options.limitResponsePayload = limitResponsePayload;
        }
    
        const result = await context.client.updateTaskSnoozeDate(
          taskId,
          newDay,
          options,
        );
    
        return formatJsonResponse({
          success: result.success,
          taskId,
          newDay,
          updatedFields: result.updatedFields,
        });
      },
    });
    
    export const updateTaskBacklogTool = withTransportClient({
      name: "update-task-backlog",
      description: "Move a task to the backlog",
      parameters: updateTaskBacklogSchema,
      execute: async (
        { taskId, timezone, limitResponsePayload }: UpdateTaskBacklogInput,
        context: ToolContext,
      ) => {
        const options: { timezone?: string; limitResponsePayload?: boolean } = {};
        if (timezone) options.timezone = timezone;
        if (limitResponsePayload !== undefined) {
          options.limitResponsePayload = limitResponsePayload;
        }
    
        const result = await context.client.updateTaskSnoozeDate(
          taskId,
          null,
          options,
        );
    
        return formatJsonResponse({
          success: result.success,
          taskId,
          movedToBacklog: true,
          updatedFields: result.updatedFields,
        });
      },
    });
    
    export const updateTaskPlannedTimeTool = withTransportClient({
      name: "update-task-planned-time",
      description: "Update the planned time (time estimate) for a task",
      parameters: updateTaskPlannedTimeSchema,
      execute: async (
        { taskId, timeEstimateMinutes, limitResponsePayload }:
          UpdateTaskPlannedTimeInput,
        context: ToolContext,
      ) => {
        const result = await context.client.updateTaskPlannedTime(
          taskId,
          timeEstimateMinutes,
          limitResponsePayload,
        );
    
        return formatJsonResponse({
          success: result.success,
          taskId,
          timeEstimateMinutes,
          updatedFields: result.updatedFields,
        });
      },
    });
    
    export const updateTaskNotesTool = withTransportClient({
      name: "update-task-notes",
      description: "Update the notes content for a task",
      parameters: updateTaskNotesSchema,
      execute: async (
        { taskId, html, markdown, limitResponsePayload }: UpdateTaskNotesInput,
        context: ToolContext,
      ) => {
        const content = html
          ? { type: "html" as const, value: html }
          : { type: "markdown" as const, value: markdown! };
    
        const options: { limitResponsePayload?: boolean } = {};
        if (limitResponsePayload !== undefined) {
          options.limitResponsePayload = limitResponsePayload;
        }
    
        const apiContent = content.type === "html"
          ? { html: content.value }
          : { markdown: content.value };
        const result = await context.client.updateTaskNotes(
          taskId,
          apiContent,
          options,
        );
    
        return formatJsonResponse({
          success: result.success,
          taskId,
          notesUpdated: true,
          updatedFields: result.updatedFields,
        });
      },
    });
    
    export const updateTaskDueDateTool = withTransportClient({
      name: "update-task-due-date",
      description: "Update the due date for a task",
      parameters: updateTaskDueDateSchema,
      execute: async (
        { taskId, dueDate, limitResponsePayload }: UpdateTaskDueDateInput,
        context: ToolContext,
      ) => {
        const result = await context.client.updateTaskDueDate(
          taskId,
          dueDate,
          limitResponsePayload,
        );
    
        return formatJsonResponse({
          success: result.success,
          taskId,
          dueDate,
          dueDateUpdated: true,
          updatedFields: result.updatedFields,
        });
      },
    });
    
    export const updateTaskTextTool = withTransportClient({
      name: "update-task-text",
      description: "Update the text/title of a task",
      parameters: updateTaskTextSchema,
      execute: async (
        { taskId, text, recommendedStreamId, limitResponsePayload }:
          UpdateTaskTextInput,
        context: ToolContext,
      ) => {
        const options: {
          recommendedStreamId?: string | null;
          limitResponsePayload?: boolean;
        } = {};
        if (recommendedStreamId !== undefined) {
          options.recommendedStreamId = recommendedStreamId;
        }
        if (limitResponsePayload !== undefined) {
          options.limitResponsePayload = limitResponsePayload;
        }
    
        const result = await context.client.updateTaskText(taskId, text, options);
    
        return formatJsonResponse({
          success: result.success,
          taskId,
          text,
          textUpdated: true,
          updatedFields: result.updatedFields,
        });
      },
    });
    
    export const updateTaskStreamTool = withTransportClient({
      name: "update-task-stream",
      description: "Update the stream/channel assignment for a task",
      parameters: updateTaskStreamSchema,
      execute: async (
        { taskId, streamId, limitResponsePayload }: UpdateTaskStreamInput,
        context: ToolContext,
      ) => {
        const result = await context.client.updateTaskStream(
          taskId,
          streamId,
          limitResponsePayload !== undefined ? limitResponsePayload : true,
        );
    
        return formatJsonResponse({
          success: result.success,
          taskId,
          streamId,
          streamUpdated: true,
          updatedFields: result.updatedFields,
        });
      },
    });
    
    // Export all task tools
    export const taskTools = [
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. It states a read operation ('Get') but doesn't cover aspects like permissions, rate limits, return format, pagination, or error handling. This is a significant gap for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words, making it easy to parse. However, it's under-specified for the tool's complexity, which slightly reduces its effectiveness despite the concise form.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's purpose (retrieving tasks) and the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'backlog' entails, the return format, or behavioral traits, leaving the agent with insufficient information for reliable use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, but this is acceptable given the lack of parameters, aligning with the baseline for zero parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get tasks from the backlog' clearly states the action (get) and resource (tasks from backlog), but it's vague about scope (e.g., all tasks, filtered, paginated) and doesn't distinguish from siblings like 'get-archived-tasks' or 'get-tasks-by-day'. It's functional but lacks specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as 'get-archived-tasks' or 'get-tasks-by-day'. The description implies usage for backlog tasks but doesn't specify context, exclusions, or prerequisites, leaving the agent to infer based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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