Implement validate-dependencies MCP command for checking dependency validity

This commit is contained in:
Eyal Toledano
2025-03-31 13:55:07 -04:00
parent fba6131db7
commit 535fb5be71
7 changed files with 127 additions and 24 deletions

View File

@@ -0,0 +1,34 @@
/**
* tools/validate-dependencies.js
* Tool for validating task dependencies
*/
import { z } from "zod";
import {
handleApiResult,
createErrorResponse
} from "./utils.js";
import { validateDependenciesDirect } from "../core/task-master-core.js";
/**
* Register the validateDependencies tool with the MCP server
* @param {Object} server - FastMCP server instance
*/
export function registerValidateDependenciesTool(server) {
server.addTool({
name: "validate_dependencies",
description: "Identify invalid dependencies in tasks without fixing them",
parameters: z.object({
file: z.string().optional().describe("Path to the tasks file"),
projectRoot: z.string().optional().describe("Root directory of the project (default: current working directory)")
}),
handler: async ({ file, projectRoot }, { logger }) => {
try {
const result = await validateDependenciesDirect({ file, projectRoot }, logger);
return handleApiResult(result);
} catch (error) {
return createErrorResponse(error);
}
}
});
}