initialize_task
Creates a new task with description and optional checklist items to break down complex work into manageable pieces for structured tracking and progress monitoring.
Instructions
Creates a new task with the specified description and optional initial checklist items.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_description | Yes | A medium-level detailed description about the whole task | |
| context_for_all_tasks | No | Information that all tasks in the checklist should include | |
| initial_checklist | No | Optional initial checklist items | |
| metadata | No | Optional metadata for the task |
Implementation Reference
- src/index.ts:546-600 (handler)The core handler function that implements the logic for the 'initialize_task' tool. It creates a new TaskData object from arguments, ensures checklist items have 'done' property, persists it to file, and returns success or error response.private async initializeTask(args: any): Promise<any> { if (!args?.task_description) { throw new McpError(ErrorCode.InvalidParams, 'Task description is required'); } try { // Create a new task data object const taskData: TaskData = { task_description: args.task_description, checklist: args.initial_checklist || [], context_for_all_tasks: args.context_for_all_tasks || '', metadata: { created_at: new Date().toISOString(), updated_at: new Date().toISOString(), progress: { completed: 0, total: args.initial_checklist ? args.initial_checklist.length : 0, percentage: 0 }, ...(args.metadata || {}) }, notes: [], resources: [] }; // Ensure all checklist items have the done property taskData.checklist = taskData.checklist.map(item => ({ ...item, done: item.done || false })); // Write the task data to the file await this.writeTaskData(taskData); return { content: [ { type: 'text', text: 'Task initialized successfully.', }, ], }; } catch (error) { console.error('Error initializing task:', error); return { content: [ { type: 'text', text: `Error initializing task: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
- src/index.ts:111-173 (schema)The input schema defining the expected arguments for the 'initialize_task' tool, including task_description (required), context_for_all_tasks, initial_checklist, and metadata.inputSchema: { type: 'object', properties: { task_description: { type: 'string', description: 'A medium-level detailed description about the whole task' }, context_for_all_tasks: { type: 'string', description: 'Information that all tasks in the checklist should include' }, initial_checklist: { type: 'array', description: 'Optional initial checklist items', items: { type: 'object', properties: { task: { type: 'string', description: 'A short yet comprehensive name for the task' }, detailed_description: { type: 'string', description: 'A longer description about what we want to achieve with this task' }, context_and_plan: { type: 'string', description: 'Related information, files the agent should read, and more details from other tasks, as well as a detailed plan for this task' }, done: { type: 'boolean', description: 'Whether the task is already completed', default: false } }, required: ['task', 'detailed_description'] } }, metadata: { type: 'object', description: 'Optional metadata for the task', properties: { tags: { type: 'array', items: { type: 'string' }, description: 'Tags to categorize the task' }, priority: { type: 'string', enum: ['high', 'medium', 'low'], description: 'Priority level of the task' }, estimated_completion_time: { type: 'string', description: 'Estimated completion time (ISO timestamp or duration)' } } } }, required: ['task_description'] }
- src/index.ts:423-425 (registration)The switch case in the CallToolRequestSchema handler that dispatches calls to the 'initialize_task' handler function.switch (request.params.name) { case 'initialize_task': return await this.initializeTask(request.params.arguments);
- src/index.ts:108-174 (registration)The tool registration entry in the ListToolsRequestSchema response, providing name, description, and schema for discovery.{ name: 'initialize_task', description: 'Creates a new task with the specified description and optional initial checklist items.', inputSchema: { type: 'object', properties: { task_description: { type: 'string', description: 'A medium-level detailed description about the whole task' }, context_for_all_tasks: { type: 'string', description: 'Information that all tasks in the checklist should include' }, initial_checklist: { type: 'array', description: 'Optional initial checklist items', items: { type: 'object', properties: { task: { type: 'string', description: 'A short yet comprehensive name for the task' }, detailed_description: { type: 'string', description: 'A longer description about what we want to achieve with this task' }, context_and_plan: { type: 'string', description: 'Related information, files the agent should read, and more details from other tasks, as well as a detailed plan for this task' }, done: { type: 'boolean', description: 'Whether the task is already completed', default: false } }, required: ['task', 'detailed_description'] } }, metadata: { type: 'object', description: 'Optional metadata for the task', properties: { tags: { type: 'array', items: { type: 'string' }, description: 'Tags to categorize the task' }, priority: { type: 'string', enum: ['high', 'medium', 'low'], description: 'Priority level of the task' }, estimated_completion_time: { type: 'string', description: 'Estimated completion time (ISO timestamp or duration)' } } } }, required: ['task_description'] } },