@@ -330,7 +330,7 @@ Example: todo-update(task1, completed) + filesystem-edit(task2) → Update while
330330 } ,
331331 {
332332 name : 'todo-add' ,
333- description : `Add new task to existing TODO list when requirements expand.
333+ description : `Add one or multiple new tasks to existing TODO list when requirements expand.
334334
335335 MANDATORY RULE - PARALLEL CALLS ONLY:
336336 NEVER call todo-add alone! MUST call with other tools in the SAME function call block.
@@ -342,19 +342,34 @@ USE WHEN:
342342- You discover additional necessary steps
343343- Breaking down a complex task into subtasks
344344
345+ SUPPORTS BOTH:
346+ - Single task: Pass a string for 'content'
347+ - Multiple tasks: Pass an array of strings for 'content' to batch add tasks efficiently
348+
345349TODO will be automatically created for each session.` ,
346350 inputSchema : {
347351 type : 'object' ,
348352 properties : {
349353 content : {
350- type : 'string' ,
354+ oneOf : [
355+ {
356+ type : 'string' ,
357+ description : 'Single TODO item description' ,
358+ } ,
359+ {
360+ type : 'array' ,
361+ items : { type : 'string' } ,
362+ description :
363+ 'Multiple TODO item descriptions for batch adding' ,
364+ } ,
365+ ] ,
351366 description :
352- 'TODO item description - must be specific, actionable, and technically precise' ,
367+ 'TODO item description(s) - must be specific, actionable, and technically precise. Can be a single string or an array of strings. ' ,
353368 } ,
354369 parentId : {
355370 type : 'string' ,
356371 description :
357- 'Parent TODO ID to create a subtask (optional). Get valid IDs from todo-get.' ,
372+ 'Parent TODO ID to create a subtask (optional). Get valid IDs from todo-get. When adding multiple tasks, all will be added under the same parent. ' ,
358373 } ,
359374 } ,
360375 required : [ 'content' ] ,
@@ -455,19 +470,37 @@ Proactively delete obsolete, redundant, or overly detailed completed subtasks to
455470
456471 case 'add' : {
457472 const { content, parentId} = args as {
458- content : string ;
473+ content : string | string [ ] ;
459474 parentId ?: string ;
460475 } ;
461476
462- const result = await this . addTodoItem ( sessionId , content , parentId ) ;
463- return {
464- content : [
465- {
466- type : 'text' ,
467- text : JSON . stringify ( result , null , 2 ) ,
468- } ,
469- ] ,
470- } ;
477+ // 支持批量添加或单个添加
478+ if ( Array . isArray ( content ) ) {
479+ // 批量添加多个TODO项
480+ let currentList = await this . getTodoList ( sessionId ) ;
481+ for ( const item of content ) {
482+ currentList = await this . addTodoItem ( sessionId , item , parentId ) ;
483+ }
484+ return {
485+ content : [
486+ {
487+ type : 'text' ,
488+ text : JSON . stringify ( currentList , null , 2 ) ,
489+ } ,
490+ ] ,
491+ } ;
492+ } else {
493+ // 单个添加
494+ const result = await this . addTodoItem ( sessionId , content , parentId ) ;
495+ return {
496+ content : [
497+ {
498+ type : 'text' ,
499+ text : JSON . stringify ( result , null , 2 ) ,
500+ } ,
501+ ] ,
502+ } ;
503+ }
471504 }
472505
473506 case 'delete' : {
0 commit comments