Skip to main content
Glama
aafsar

Task Manager MCP Server

by aafsar

complete_task

Mark a task as completed by providing its task ID to update task status in the Task Manager MCP Server.

Instructions

Mark a task as completed

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdYesTask ID (use first 8 characters)

Implementation Reference

  • The main handler function for the 'complete_task' tool. It validates the input task ID using TaskIdSchema, loads tasks from storage, finds the matching task by partial ID, updates its status to 'completed' and sets the completion timestamp, saves the changes, and returns a formatted success message with task details.
    export async function completeTask(args: unknown) { // Validate input const validated = TaskIdSchema.parse(args); // Load tasks const storage = await loadTasks(); // Find task const task = storage.tasks.find((t) => t.id.startsWith(validated.taskId)); if (!task) { return { content: [ { type: "text", text: `❌ Task with ID ${validated.taskId} not found.`, }, ], }; } // Update status task.status = "completed"; task.completedAt = new Date().toISOString(); await saveTasks(storage); return { content: [ { type: "text", text: `✅ Task completed!\n\n${formatTask(task)}`, }, ], }; }
  • Zod validation schema for the 'complete_task' tool input. Defines 'taskId' as a required string with minimum length 8 characters (first 8 chars of UUID). Used in completeTask and deleteTask functions.
    export const TaskIdSchema = z.object({ taskId: z.string().min(8, "Task ID must be at least 8 characters"), });
  • src/index.ts:141-155 (registration)
    Tool registration in the TOOLS array for MCP server. Specifies name, description, and JSON Schema for input validation advertised to clients.
    { name: "complete_task", description: "Mark a task as completed", inputSchema: { type: "object", properties: { taskId: { type: "string", description: "Task ID (use first 8 characters)", minLength: 8, }, }, required: ["taskId"], }, },
  • src/index.ts:227-228 (registration)
    Dispatch logic in the CallToolRequest handler switch statement. Routes 'complete_task' calls to the completeTask implementation.
    case "complete_task": return await completeTask(args);
  • src/index.ts:17-17 (registration)
    Import of the completeTask handler from './tools.js' for use in the MCP server.
    completeTask,

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/aafsar/task-manager-mcp-server'

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