fix: add rest of tools that need wrapper

This commit is contained in:
Ralph Khreish
2025-05-02 19:56:13 +02:00
parent d18351dc38
commit 8f8a3dc45d
4 changed files with 25 additions and 40 deletions

View File

@@ -1,5 +1,9 @@
import { z } from 'zod';
import { createErrorResponse, handleApiResult } from './utils.js';
import {
createErrorResponse,
handleApiResult,
withNormalizedProjectRoot
} from './utils.js';
import { initializeProjectDirect } from '../core/task-master-core.js';
export function registerInitializeProjectTool(server) {
@@ -33,19 +37,10 @@ export function registerInitializeProjectTool(server) {
'The root directory for the project. ALWAYS SET THIS TO THE PROJECT ROOT DIRECTORY. IF NOT SET, THE TOOL WILL NOT WORK.'
)
}),
execute: async (args, context) => {
execute: withNormalizedProjectRoot(async (args, context) => {
const { log } = context;
const session = context.session;
log.info(
'>>> Full Context Received by Tool:',
JSON.stringify(context, null, 2)
);
log.info(`Context received in tool function: ${context}`);
log.info(
`Session received in tool function: ${session ? session : 'undefined'}`
);
try {
log.info(
`Executing initialize_project tool with args: ${JSON.stringify(args)}`
@@ -59,6 +54,6 @@ export function registerInitializeProjectTool(server) {
log.error(errorMessage, error);
return createErrorResponse(errorMessage, { details: error.stack });
}
}
})
});
}