fix: adjust mcp to always use absolute path in description (#143)

This commit is contained in:
Ralph Khreish
2025-04-09 20:52:29 +02:00
committed by GitHub
parent cfe3ba91e8
commit b78535ac19
20 changed files with 37 additions and 25 deletions

View File

@@ -27,7 +27,9 @@ export function registerAddDependencyTool(server) {
file: z file: z
.string() .string()
.optional() .optional()
.describe('Path to the tasks file (default: tasks/tasks.json)'), .describe(
'Absolute path to the tasks file (default: tasks/tasks.json)'
),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -48,7 +48,9 @@ export function registerAddSubtaskTool(server) {
file: z file: z
.string() .string()
.optional() .optional()
.describe('Path to the tasks file (default: tasks/tasks.json)'), .describe(
'Absolute path to the tasks file (default: tasks/tasks.json)'
),
skipGenerate: z skipGenerate: z
.boolean() .boolean()
.optional() .optional()

View File

@@ -31,7 +31,7 @@ export function registerAddTaskTool(server) {
.string() .string()
.optional() .optional()
.describe('Task priority (high, medium, low)'), .describe('Task priority (high, medium, low)'),
file: z.string().optional().describe('Path to the tasks file'), file: z.string().optional().describe('Absolute path to the tasks file'),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -42,7 +42,9 @@ export function registerAnalyzeTool(server) {
file: z file: z
.string() .string()
.optional() .optional()
.describe('Path to the tasks file (default: tasks/tasks.json)'), .describe(
'Absolute path to the tasks file (default: tasks/tasks.json)'
),
research: z research: z
.boolean() .boolean()
.optional() .optional()

View File

@@ -29,7 +29,9 @@ export function registerClearSubtasksTool(server) {
file: z file: z
.string() .string()
.optional() .optional()
.describe('Path to the tasks file (default: tasks/tasks.json)'), .describe(
'Absolute path to the tasks file (default: tasks/tasks.json)'
),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -43,7 +43,9 @@ export function registerExpandAllTool(server) {
file: z file: z
.string() .string()
.optional() .optional()
.describe('Path to the tasks file (default: tasks/tasks.json)'), .describe(
'Absolute path to the tasks file (default: tasks/tasks.json)'
),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -35,7 +35,7 @@ export function registerExpandTaskTool(server) {
.string() .string()
.optional() .optional()
.describe('Additional context for subtask generation'), .describe('Additional context for subtask generation'),
file: z.string().optional().describe('Path to the tasks file'), file: z.string().optional().describe('Absolute path to the tasks file'),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()
@@ -43,7 +43,7 @@ export function registerExpandTaskTool(server) {
'Root directory of the project (default: current working directory)' 'Root directory of the project (default: current working directory)'
) )
}), }),
execute: async (args, { log, reportProgress, session }) => { execute: async (args, { log, session }) => {
try { try {
log.info(`Starting expand-task with args: ${JSON.stringify(args)}`); log.info(`Starting expand-task with args: ${JSON.stringify(args)}`);

View File

@@ -20,7 +20,7 @@ export function registerFixDependenciesTool(server) {
name: 'fix_dependencies', name: 'fix_dependencies',
description: 'Fix invalid dependencies in tasks automatically', description: 'Fix invalid dependencies in tasks automatically',
parameters: z.object({ parameters: z.object({
file: z.string().optional().describe('Path to the tasks file'), file: z.string().optional().describe('Absolute path to the tasks file'),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -21,7 +21,7 @@ export function registerGenerateTool(server) {
description: description:
'Generates individual task files in tasks/ directory based on tasks.json', 'Generates individual task files in tasks/ directory based on tasks.json',
parameters: z.object({ parameters: z.object({
file: z.string().optional().describe('Path to the tasks file'), file: z.string().optional().describe('Absolute path to the tasks file'),
output: z output: z
.string() .string()
.optional() .optional()

View File

@@ -39,7 +39,7 @@ export function registerShowTaskTool(server) {
description: 'Get detailed information about a specific task', description: 'Get detailed information about a specific task',
parameters: z.object({ parameters: z.object({
id: z.string().describe('Task ID to get'), id: z.string().describe('Task ID to get'),
file: z.string().optional().describe('Path to the tasks file'), file: z.string().optional().describe('Absolute path to the tasks file'),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -21,7 +21,7 @@ export function registerNextTaskTool(server) {
description: description:
'Find the next task to work on based on dependencies and status', 'Find the next task to work on based on dependencies and status',
parameters: z.object({ parameters: z.object({
file: z.string().optional().describe('Path to the tasks file'), file: z.string().optional().describe('Absolute path to the tasks file'),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -24,9 +24,7 @@ export function registerParsePRDTool(server) {
input: z input: z
.string() .string()
.default('tasks/tasks.json') .default('tasks/tasks.json')
.describe( .describe('Absolute path to the PRD document file'),
'Path to the PRD document file (relative to project root or absolute)'
),
numTasks: z numTasks: z
.string() .string()
.optional() .optional()
@@ -37,7 +35,7 @@ export function registerParsePRDTool(server) {
.string() .string()
.optional() .optional()
.describe( .describe(
'Output path for tasks.json file (relative to project root or absolute, default: tasks/tasks.json)' 'Output absolute path for tasks.json file (default: tasks/tasks.json)'
), ),
force: z force: z
.boolean() .boolean()
@@ -47,7 +45,7 @@ export function registerParsePRDTool(server) {
.string() .string()
.optional() .optional()
.describe( .describe(
'Root directory of the project (default: automatically detected from session or CWD)' 'Absolute path to the root directory of the project (default: automatically detected from session or CWD)'
) )
}), }),
execute: async (args, { log, session }) => { execute: async (args, { log, session }) => {

View File

@@ -25,7 +25,9 @@ export function registerRemoveDependencyTool(server) {
file: z file: z
.string() .string()
.optional() .optional()
.describe('Path to the tasks file (default: tasks/tasks.json)'), .describe(
'Absolute path to the tasks file (default: tasks/tasks.json)'
),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -34,7 +34,9 @@ export function registerRemoveSubtaskTool(server) {
file: z file: z
.string() .string()
.optional() .optional()
.describe('Path to the tasks file (default: tasks/tasks.json)'), .describe(
'Absolute path to the tasks file (default: tasks/tasks.json)'
),
skipGenerate: z skipGenerate: z
.boolean() .boolean()
.optional() .optional()

View File

@@ -23,7 +23,7 @@ export function registerRemoveTaskTool(server) {
id: z id: z
.string() .string()
.describe("ID of the task or subtask to remove (e.g., '5' or '5.2')"), .describe("ID of the task or subtask to remove (e.g., '5' or '5.2')"),
file: z.string().optional().describe('Path to the tasks file'), file: z.string().optional().describe('Absolute path to the tasks file'),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -30,7 +30,7 @@ export function registerSetTaskStatusTool(server) {
.describe( .describe(
"New status to set (e.g., 'pending', 'done', 'in-progress', 'review', 'deferred', 'cancelled'." "New status to set (e.g., 'pending', 'done', 'in-progress', 'review', 'deferred', 'cancelled'."
), ),
file: z.string().optional().describe('Path to the tasks file'), file: z.string().optional().describe('Absolute path to the tasks file'),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -31,7 +31,7 @@ export function registerUpdateSubtaskTool(server) {
.boolean() .boolean()
.optional() .optional()
.describe('Use Perplexity AI for research-backed updates'), .describe('Use Perplexity AI for research-backed updates'),
file: z.string().optional().describe('Path to the tasks file'), file: z.string().optional().describe('Absolute path to the tasks file'),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -31,7 +31,7 @@ export function registerUpdateTaskTool(server) {
.boolean() .boolean()
.optional() .optional()
.describe('Use Perplexity AI for research-backed updates'), .describe('Use Perplexity AI for research-backed updates'),
file: z.string().optional().describe('Path to the tasks file'), file: z.string().optional().describe('Absolute path to the tasks file'),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -33,7 +33,7 @@ export function registerUpdateTool(server) {
.boolean() .boolean()
.optional() .optional()
.describe('Use Perplexity AI for research-backed updates'), .describe('Use Perplexity AI for research-backed updates'),
file: z.string().optional().describe('Path to the tasks file'), file: z.string().optional().describe('Absolute path to the tasks file'),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()

View File

@@ -21,7 +21,7 @@ export function registerValidateDependenciesTool(server) {
description: description:
'Check tasks for dependency issues (like circular references or links to non-existent tasks) without making changes.', 'Check tasks for dependency issues (like circular references or links to non-existent tasks) without making changes.',
parameters: z.object({ parameters: z.object({
file: z.string().optional().describe('Path to the tasks file'), file: z.string().optional().describe('Absolute path to the tasks file'),
projectRoot: z projectRoot: z
.string() .string()
.optional() .optional()