fix: update MCP tool

This commit is contained in:
Ralph Khreish
2025-06-07 13:26:46 +02:00
parent c0707fc399
commit ee0be04302
2 changed files with 9 additions and 9 deletions

View File

@@ -0,0 +1,5 @@
---
"task-master-ai": patch
---
Fix update tool on MCP giving `No valid tasks found`

View File

@@ -21,7 +21,7 @@ import {
*/ */
export async function updateTasksDirect(args, log, context = {}) { export async function updateTasksDirect(args, log, context = {}) {
const { session } = context; const { session } = context;
const { from, prompt, research, file: fileArg, projectRoot } = args; const { from, prompt, research, tasksJsonPath, projectRoot } = args;
// Create the standard logger wrapper // Create the standard logger wrapper
const logWrapper = createLogWrapper(log); const logWrapper = createLogWrapper(log);
@@ -60,20 +60,15 @@ export async function updateTasksDirect(args, log, context = {}) {
}; };
} }
// Resolve tasks file path
const tasksFile = fileArg
? path.resolve(projectRoot, fileArg)
: path.resolve(projectRoot, 'tasks', 'tasks.json');
logWrapper.info( logWrapper.info(
`Updating tasks via direct function. From: ${from}, Research: ${research}, File: ${tasksFile}, ProjectRoot: ${projectRoot}` `Updating tasks via direct function. From: ${from}, Research: ${research}, File: ${tasksJsonPath}, ProjectRoot: ${projectRoot}`
); );
enableSilentMode(); // Enable silent mode enableSilentMode(); // Enable silent mode
try { try {
// Call the core updateTasks function // Call the core updateTasks function
const result = await updateTasks( const result = await updateTasks(
tasksFile, tasksJsonPath,
from, from,
prompt, prompt,
research, research,
@@ -93,7 +88,7 @@ export async function updateTasksDirect(args, log, context = {}) {
success: true, success: true,
data: { data: {
message: `Successfully updated ${result.updatedTasks.length} tasks.`, message: `Successfully updated ${result.updatedTasks.length} tasks.`,
tasksFile, tasksPath: tasksJsonPath,
updatedCount: result.updatedTasks.length, updatedCount: result.updatedTasks.length,
telemetryData: result.telemetryData telemetryData: result.telemetryData
} }