Skip to main content
Glama
aafsar

Task Manager MCP Server

by aafsar

create_task

Add new tasks to your task management system by specifying title, description, priority, category, and due date for organized tracking.

Instructions

Create a new task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesTask title (required)
descriptionNoDetailed description
priorityNoTask prioritymedium
categoryNoTask category (work/personal/etc)
dueDateNoDue date in YYYY-MM-DD format

Implementation Reference

  • The core handler function for the 'create_task' tool. Validates input using CreateTaskSchema, generates a new task with UUID, adds it to storage, and returns a formatted success message.
    export async function createTask(args: unknown) {
      // Validate input
      const validated = CreateTaskSchema.parse(args);
    
      // Load existing tasks
      const storage = await loadTasks();
    
      // Create new task
      const newTask: Task = {
        id: uuidv4(),
        title: validated.title,
        description: validated.description,
        priority: validated.priority as Priority,
        category: validated.category,
        dueDate: validated.dueDate,
        status: "pending",
        createdAt: new Date().toISOString(),
      };
    
      // Add to storage
      storage.tasks.push(newTask);
      await saveTasks(storage);
    
      return {
        content: [
          {
            type: "text",
            text: `✅ Task created successfully!\n\n${formatTask(newTask)}`,
          },
        ],
      };
    }
  • Zod schema used for input validation in the createTask handler.
    export const CreateTaskSchema = z.object({
      title: z.string().min(1, "Title is required"),
      description: z.string().optional(),
      priority: z.enum(["low", "medium", "high"]).default("medium"),
      category: z.string().optional(),
      dueDate: z
        .string()
        .regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be YYYY-MM-DD")
        .optional(),
    });
  • src/index.ts:26-57 (registration)
    Tool registration in the TOOLS array, defining name, description, and JSON inputSchema for the MCP ListTools request.
    {
      name: "create_task",
      description: "Create a new task",
      inputSchema: {
        type: "object",
        properties: {
          title: {
            type: "string",
            description: "Task title (required)",
          },
          description: {
            type: "string",
            description: "Detailed description",
          },
          priority: {
            type: "string",
            enum: ["low", "medium", "high"],
            default: "medium",
            description: "Task priority",
          },
          category: {
            type: "string",
            description: "Task category (work/personal/etc)",
          },
          dueDate: {
            type: "string",
            pattern: "^\\d{4}-\\d{2}-\\d{2}$",
            description: "Due date in YYYY-MM-DD format",
          },
        },
        required: ["title"],
      },
  • src/index.ts:215-216 (registration)
    Dispatch handler in the switch statement that routes 'create_task' calls to the createTask function.
    case "create_task":
      return await createTask(args);
  • src/index.ts:13-14 (registration)
    Import of the createTask handler from './tools.js'.
    createTask,
    listTasks,

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