Skip to main content
Glama

update-task-complete

Mark Sunsama tasks as complete with optional timestamp to track task completion and maintain updated task status.

Instructions

Mark a task as complete with optional completion timestamp

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
completeOnNoCompletion timestamp (ISO format). Defaults to current time
limitResponsePayloadNoWhether to limit the response payload size
taskIdYesThe ID of the task to mark as complete

Implementation Reference

  • The core handler function that executes the tool logic: marks the specified task as complete using the Sunsama client API, with optional completion timestamp and payload limiting, and returns a formatted JSON response.
    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, }); }, });
  • Zod schema defining the input parameters for the tool: taskId (required), completeOn (optional ISO timestamp), limitResponsePayload (optional boolean).
    export const updateTaskCompleteSchema = z.object({ taskId: z.string().min(1, "Task ID is required").describe( "The ID of the task to mark as complete", ), completeOn: z.string().optional().describe( "Completion timestamp (ISO format). Defaults to current time", ), limitResponsePayload: z.boolean().optional().describe( "Whether to limit the response payload size", ), });
  • src/main.ts:32-44 (registration)
    Generic registration of all tools (including update-task-complete) to the MCP server via forEach loop over 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, ); });
  • Higher-order function that wraps the raw tool config, injects transport-aware client, handles execution context, and ensures 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; } } }; }
  • Utility function used by the handler to format the tool response as MCP-compliant JSON text content.
    export function formatJsonResponse(data: any) { return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], };

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