Skip to main content
Glama
robertn702

Sunsama MCP Server

update-task-text

Modify task titles in Sunsama by providing the task ID and new text to update task descriptions and keep project information current.

Instructions

Update the text/title of a task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitResponsePayloadNoWhether to limit the response payload size
recommendedStreamIdNoRecommended stream ID (optional)
taskIdYesThe ID of the task to update
textYesThe new text/title for the task

Implementation Reference

  • The handler function that implements the core logic of the 'update-task-text' tool by calling the Sunsama client to update the task's text and returning a formatted JSON response.
    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,
        });
      },
    });
  • Zod schema that validates and describes the input parameters for the 'update-task-text' tool.
    export const updateTaskTextSchema = z.object({
      taskId: z.string().min(1, "Task ID is required").describe(
        "The ID of the task to update",
      ),
      text: z.string().min(1, "Task text is required").describe(
        "The new text/title for the task",
      ),
      recommendedStreamId: z.string().nullable().optional().describe(
        "Recommended stream ID (optional)",
      ),
      limitResponsePayload: z.boolean().optional().describe(
        "Whether to limit the response payload size",
      ),
    });
  • src/main.ts:32-44 (registration)
    The registration code in the MCP server setup that registers all tools, including 'update-task-text', by iterating over the allTools array.
    // 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,
      );
    });
  • The taskTools array where 'updateTaskTextTool' is included and exported for further aggregation into allTools and registration.
    export const taskTools = [
      // Query tools
      getTasksBacklogTool,
      getTasksByDayTool,
      getArchivedTasksTool,
      getTaskByIdTool,
    
      // Lifecycle tools
      createTaskTool,
      deleteTaskTool,
    
      // Update tools
      updateTaskCompleteTool,
      updateTaskSnoozeDateTool,
      updateTaskBacklogTool,
      updateTaskPlannedTimeTool,
      updateTaskNotesTool,
      updateTaskDueDateTool,
      updateTaskTextTool,
      updateTaskStreamTool,
    ];
  • The withTransportClient higher-order function used to wrap the raw tool config, providing transport-aware client resolution and MCP-compliant response formatting.
    export function withTransportClient(toolConfig: ToolConfig) {
      return {
        name: toolConfig.name,
        description: toolConfig.description,
        parameters: toolConfig.parameters,
        execute: async (args: any, extra: any = {}) => {
          try {
            // Auto-resolve client based on transport
            const client = await getClient(extra.session);
    
            // Execute tool with injected client
            const context: ToolContext = { ...extra, client };
            const result = await toolConfig.execute(args, context);
    
            // Ensure MCP-compliant response format
            if (result && Array.isArray(result.content)) {
              return result;
            }
    
            // Wrap if needed
            return {
              content: [
                {
                  type: "text",
                  text: typeof result === "string"
                    ? result
                    : JSON.stringify(result, null, 2)
                }
              ]
            };
          } catch (error) {
            console.error(`Tool ${toolConfig.name} error:`, error);
            throw error;
          }
        }
      };
    }

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