Fix: MCP log errors (#648)

This commit is contained in:
Ralph Khreish
2025-06-03 01:09:29 +02:00
committed by GitHub
parent ad612763ff
commit 9b4168bb4e
24 changed files with 226 additions and 218 deletions

View File

@@ -29,7 +29,7 @@ import { createLogWrapper } from '../../tools/utils.js';
* @param {Object} log - Logger object
* @param {Object} context - Context object containing session
* @param {Object} [context.session] - MCP Session object
* @returns {Promise<Object>} - Task expansion result { success: boolean, data?: any, error?: { code: string, message: string }, fromCache: boolean }
* @returns {Promise<Object>} - Task expansion result { success: boolean, data?: any, error?: { code: string, message: string } }
*/
export async function expandTaskDirect(args, log, context = {}) {
const { session } = context; // Extract session
@@ -54,8 +54,7 @@ export async function expandTaskDirect(args, log, context = {}) {
error: {
code: 'MISSING_ARGUMENT',
message: 'tasksJsonPath is required'
},
fromCache: false
}
};
}
@@ -73,8 +72,7 @@ export async function expandTaskDirect(args, log, context = {}) {
error: {
code: 'INPUT_VALIDATION_ERROR',
message: 'Task ID is required'
},
fromCache: false
}
};
}
@@ -105,8 +103,7 @@ export async function expandTaskDirect(args, log, context = {}) {
error: {
code: 'INVALID_TASKS_FILE',
message: `No valid tasks found in ${tasksPath}. readJSON returned: ${JSON.stringify(data)}`
},
fromCache: false
}
};
}
@@ -121,8 +118,7 @@ export async function expandTaskDirect(args, log, context = {}) {
error: {
code: 'TASK_NOT_FOUND',
message: `Task with ID ${taskId} not found`
},
fromCache: false
}
};
}
@@ -133,8 +129,7 @@ export async function expandTaskDirect(args, log, context = {}) {
error: {
code: 'TASK_COMPLETED',
message: `Task ${taskId} is already marked as ${task.status} and cannot be expanded`
},
fromCache: false
}
};
}
@@ -151,8 +146,7 @@ export async function expandTaskDirect(args, log, context = {}) {
task,
subtasksAdded: 0,
hasExistingSubtasks
},
fromCache: false
}
};
}
@@ -232,8 +226,7 @@ export async function expandTaskDirect(args, log, context = {}) {
subtasksAdded,
hasExistingSubtasks,
telemetryData: coreResult.telemetryData
},
fromCache: false
}
};
} catch (error) {
// Make sure to restore normal logging even if there's an error
@@ -245,8 +238,7 @@ export async function expandTaskDirect(args, log, context = {}) {
error: {
code: 'CORE_FUNCTION_ERROR',
message: error.message || 'Failed to expand task'
},
fromCache: false
}
};
}
} catch (error) {
@@ -256,8 +248,7 @@ export async function expandTaskDirect(args, log, context = {}) {
error: {
code: 'CORE_FUNCTION_ERROR',
message: error.message || 'Failed to expand task'
},
fromCache: false
}
};
}
}