add_tasks_to_project
Add specific tasks, including titles, descriptions, and recommendations, to an existing project identified by its project ID.
Instructions
Add new tasks to an existing project.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"projectId": "<projectId>",
"tasks": "<tasks>"
},
"name": "add_tasks_to_project"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | The ID of the project to add tasks to (e.g., proj-1). | |
| tasks | Yes | An array of task objects to add. |
Implementation Reference
- src/server/toolExecutors.ts:356-370 (handler)The main handler (ToolExecutor) for the 'add_tasks_to_project' tool. Validates projectId and tasks array, then calls TaskManager.addTasksToProject. Registers itself in toolExecutorMap.
const addTasksToProjectToolExecutor: ToolExecutor = { name: "add_tasks_to_project", async execute(taskManager, args) { // 1. Argument Validation const projectId = validateProjectId(args.projectId); const tasks = validateTaskObjects(args.tasks); // 2. Core Logic Execution const resultData = await taskManager.addTasksToProject(projectId, tasks); // 3. Return raw success data return resultData; }, }; toolExecutorMap.set(addTasksToProjectToolExecutor.name, addTasksToProjectToolExecutor); - src/server/tools.ts:127-169 (schema)MCP Tool definition with inputSchema, description, and name for 'add_tasks_to_project'.
* @param {object} args - A JSON object containing the arguments * @see {addTasksToProjectToolExecutor} */ const addTasksToProjectTool: Tool = { name: "add_tasks_to_project", description: "Add new tasks to an existing project.", inputSchema: { type: "object", properties: { projectId: { type: "string", description: "The ID of the project to add tasks to (e.g., proj-1).", }, tasks: { type: "array", description: "An array of task objects to add.", items: { type: "object", properties: { title: { type: "string", description: "The title of the task.", }, description: { type: "string", description: "A detailed description of the task.", }, toolRecommendations: { type: "string", description: "Recommendations for tools to use to complete the task.", }, ruleRecommendations: { type: "string", description: "Recommendations for relevant rules to review when completing the task.", }, }, required: ["title", "description"], }, }, }, required: ["projectId", "tasks"], }, }; - src/server/tools.ts:432-448 (registration)Registration of the 'add_tasks_to_project' tool (as addTasksToProjectTool) in the exported ALL_TOOLS array used for MCP tool exposure.
export const ALL_TOOLS: Tool[] = [ listProjectsTool, readProjectTool, createProjectTool, deleteProjectTool, addTasksToProjectTool, finalizeProjectTool, generateProjectPlanTool, listTasksTool, readTaskTool, createTaskTool, updateTaskTool, deleteTaskTool, approveTaskTool, getNextTaskTool, ]; - src/server/TaskManager.ts:467-510 (helper)Core helper method in TaskManager that implements the logic to add tasks to a project: finds project, generates task IDs, initializes tasks, appends to project.tasks, saves to disk, returns added tasks info.
public async addTasksToProject( projectId: string, tasks: { title: string; description: string; toolRecommendations?: string; ruleRecommendations?: string }[] ): Promise<AddTasksSuccessData> { await this.ensureInitialized(); await this.reloadFromDisk(); const proj = this.data.projects.find((p) => p.projectId === projectId); if (!proj) { throw new AppError(`Project ${projectId} not found`, AppErrorCode.ProjectNotFound); } if (proj.completed) { throw new AppError('Project is already completed', AppErrorCode.ProjectAlreadyCompleted); } const newTasks: Task[] = []; for (const taskDef of tasks) { this.taskCounter += 1; const newTask: Task = { id: `task-${this.taskCounter}`, title: taskDef.title, description: taskDef.description, status: "not started", approved: false, completedDetails: "", toolRecommendations: taskDef.toolRecommendations, ruleRecommendations: taskDef.ruleRecommendations, }; newTasks.push(newTask); proj.tasks.push(newTask); } await this.saveTasks(); return { newTasks: newTasks.map((t) => ({ id: t.id, title: t.title, description: t.description, })), message: `Added ${newTasks.length} tasks to project ${projectId}`, }; }