feat: implement expand-task MCP command

- Create direct function wrapper in expand-task.js with error handling

- Add MCP tool integration for breaking down tasks into subtasks

- Update task-master-core.js to expose expandTaskDirect function

- Update changeset to document the new command

- Parameter support for subtask generation options (num, research, prompt, force)
This commit is contained in:
Eyal Toledano
2025-03-31 12:06:23 -04:00
parent 2c80973b03
commit d972c39042
7 changed files with 219 additions and 4 deletions

View File

@@ -538,7 +538,7 @@ Following MCP implementation standards:
- Unit test for showTaskDirect.js
- Integration test for MCP tool
## 23. Implement next-task MCP command [in-progress]
## 23. Implement next-task MCP command [done]
### Dependencies: None
### Description: Create direct function wrapper and MCP tool for finding the next task to work on.
### Details:
@@ -571,7 +571,7 @@ Following MCP implementation standards:
- Unit test for nextTaskDirect.js
- Integration test for MCP tool
## 24. Implement expand-task MCP command [pending]
## 24. Implement expand-task MCP command [done]
### Dependencies: None
### Description: Create direct function wrapper and MCP tool for expanding a task into subtasks.
### Details:

View File

@@ -1555,7 +1555,7 @@
"title": "Implement next-task MCP command",
"description": "Create direct function wrapper and MCP tool for finding the next task to work on.",
"details": "Following MCP implementation standards:\n\n1. Create nextTaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import nextTask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments (no specific args needed except projectRoot/file)\n - Handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create next-task.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import nextTaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerNextTaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js with tool name 'next_task'\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for nextTaskDirect.js\n - Integration test for MCP tool",
"status": "in-progress",
"status": "done",
"dependencies": [],
"parentTaskId": 23
},
@@ -1564,7 +1564,7 @@
"title": "Implement expand-task MCP command",
"description": "Create direct function wrapper and MCP tool for expanding a task into subtasks.",
"details": "Following MCP implementation standards:\n\n1. Create expandTaskDirect.js in mcp-server/src/core/direct-functions/:\n - Import expandTask from task-manager.js\n - Handle file paths using findTasksJsonPath utility\n - Process arguments: taskId, prompt, num, force, research\n - Validate inputs and handle errors with try/catch\n - Return standardized { success, data/error } object\n\n2. Export from task-master-core.js:\n - Import the function from its file\n - Add to directFunctions map\n\n3. Create expand-task.js MCP tool in mcp-server/src/tools/:\n - Import z from zod for parameter schema\n - Import executeMCPToolAction from ./utils.js\n - Import expandTaskDirect from task-master-core.js\n - Define parameters matching CLI options using zod schema\n - Implement registerExpandTaskTool(server) with server.addTool\n - Use executeMCPToolAction in execute method\n\n4. Register in tools/index.js with tool name 'expand_task'\n\n5. Add to .cursor/mcp.json with appropriate schema\n\n6. Write tests following testing guidelines:\n - Unit test for expandTaskDirect.js\n - Integration test for MCP tool",
"status": "pending",
"status": "done",
"dependencies": [],
"parentTaskId": 23
},