Skip to main content
Glama

task_create

Create tasks within project epics to organize work units with details like priority, assignee, due dates, and dependencies in a structured project tracker.

Instructions

Create a task within an epic. Tasks are the primary unit of work.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
epic_idYesParent epic ID
titleYesTask title
descriptionNoTask description
statusNotodo
priorityNomedium
assigned_toNoAssignee name
estimated_hoursNoEstimated hours
due_dateNoDue date (YYYY-MM-DD)
source_refNoLink to source code location
depends_onNoTask IDs this task depends on
tagsNo

Implementation Reference

  • The function `handleTaskCreate` which implements the logic for the `task_create` tool.
    function handleTaskCreate(args: Record<string, unknown>) {
      const db = getDb();
      const epicId = args.epic_id as number;
      const title = args.title as string;
      const description = (args.description as string) ?? null;
      const status = (args.status as string) ?? 'todo';
      const priority = (args.priority as string) ?? 'medium';
      const assignedTo = (args.assigned_to as string) ?? null;
      const estimatedHours = (args.estimated_hours as number) ?? null;
      const dueDate = (args.due_date as string) ?? null;
      const sourceRef = args.source_ref ? JSON.stringify(args.source_ref) : null;
      const tags = JSON.stringify((args.tags as string[]) ?? []);
      const dependsOn = (args.depends_on as number[]) ?? [];
    
      const task = db
        .prepare(
          `INSERT INTO tasks (epic_id, title, description, status, priority, assigned_to, estimated_hours, due_date, source_ref, tags)
           VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`
        )
        .get(epicId, title, description, status, priority, assignedTo, estimatedHours, dueDate, sourceRef, tags);
    
      const row = task as Record<string, unknown>;
      const taskId = row.id as number;
      logActivity(db, 'task', taskId, 'created', null, null, null, `Task '${title}' created`);
    
      if (dependsOn.length > 0) {
        setDependencies(db, taskId, dependsOn);
        evaluateAndUpdateDependencies(db, taskId);
        // Re-fetch to get potentially updated status
        return db.prepare('SELECT * FROM tasks WHERE id = ?').get(taskId);
      }
    
      return task;
    }
  • The MCP tool definition for `task_create` including the input schema.
    export const definitions: Tool[] = [
      {
        name: 'task_create',
        description: 'Create a task within an epic. Tasks are the primary unit of work.',
        annotations: { title: 'Create Task', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
        inputSchema: {
          type: 'object',
          properties: {
            epic_id: { type: 'integer', description: 'Parent epic ID' },
            title: { type: 'string', description: 'Task title' },
            description: { type: 'string', description: 'Task description' },
            status: {
              type: 'string',
              enum: ['todo', 'in_progress', 'review', 'done', 'blocked'],
              default: 'todo',
            },
            priority: {
              type: 'string',
              enum: ['low', 'medium', 'high', 'critical'],
              default: 'medium',
            },
            assigned_to: { type: 'string', description: 'Assignee name' },
            estimated_hours: { type: 'number', description: 'Estimated hours' },
            due_date: { type: 'string', description: 'Due date (YYYY-MM-DD)' },
            source_ref: {
              type: 'object',
              description: 'Link to source code location',
              properties: {
                file: { type: 'string', description: 'File path' },
                line_start: { type: 'integer', description: 'Start line number' },
                line_end: { type: 'integer', description: 'End line number' },
                repo: { type: 'string', description: 'Repository URL or name' },
                commit: { type: 'string', description: 'Commit hash' },
              },
              required: ['file'],
            },
            depends_on: { type: 'array', items: { type: 'integer' }, description: 'Task IDs this task depends on' },
            tags: { type: 'array', items: { type: 'string' } },
          },
          required: ['epic_id', 'title'],
        },
      },
  • Registration of the `task_create` tool handler.
    export const handlers: Record<string, ToolHandler> = {
      task_create: handleTaskCreate,
      task_list: handleTaskList,
      task_get: handleTaskGet,
      task_update: handleTaskUpdate,
    };

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/spranab/saga-mcp'

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