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
| Name | Required | Description | Default |
|---|---|---|---|
| limitResponsePayload | No | Whether to limit the response payload size | |
| recommendedStreamId | No | Recommended stream ID (optional) | |
| taskId | Yes | The ID of the task to update | |
| text | Yes | The new text/title for the task |
Implementation Reference
- src/tools/task-tools.ts:349-379 (handler)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, }); }, });
- src/schemas.ts:247-260 (schema)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, ); });
- src/tools/task-tools.ts:406-426 (registration)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, ];
- src/tools/shared.ts:29-65 (helper)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; } } }; }