Skip to main content
Glama
by blizzy78
create_task.js2.33 kB
import { zodToJsonSchema } from 'zod-to-json-schema'; import { mustDecompose, newTaskID, SimpleTaskSchema, TaskComplexitySchema, toBasicTaskInfo, TodoStatus, } from '../tasks.js'; export const CreateTaskArgsSchema = SimpleTaskSchema.extend({ estimatedComplexity: TaskComplexitySchema, }); export const CREATE_TASK = 'create_task'; export const createTaskTool = { name: CREATE_TASK, title: 'Create task', description: `Creates a new task that must be executed. If decomposing a complex task is required, must use 'decompose_task' first before executing it. All tasks start in the todo status. Must use 'update_task' before executing this task, and when executing this task has finished.`, inputSchema: zodToJsonSchema(CreateTaskArgsSchema, { $refStrategy: 'none' }), }; export async function handleCreateTask({ title, description, goal, definitionsOfDone, criticalPath, uncertaintyAreas, estimatedComplexity }, taskDB, singleAgent) { const task = { taskID: newTaskID(), status: TodoStatus, dependsOnTaskIDs: [], title, description, goal, definitionsOfDone, criticalPath: !!criticalPath, uncertaintyAreas, estimatedComplexity, lessonsLearned: [], verificationEvidence: [], }; taskDB.set(task.taskID, task); if (singleAgent) { taskDB.setCurrentTask(task.taskID); } const incompleteTaskIDs = taskDB.incompleteTasksInTree(task.taskID).map((t) => t.taskID); const res = { taskCreated: toBasicTaskInfo(task, false, false, true), incompleteTasksIdealOrder: singleAgent ? incompleteTaskIDs : undefined, }; return { content: [ mustDecompose(task) && { type: 'text', text: "Task must be decomposed before execution, use 'decompose_task' tool", audience: ['assistant'], }, { type: 'resource_link', uri: `task://${task.taskID}`, name: task.taskID, title: task.title, annotations: { audience: ['assistant'], priority: 1, }, }, ].filter(Boolean), structuredContent: res, }; }

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

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