Skip to content

Commit 9b7bb46

Browse files
Merge pull request #41 from chriscarrollsmith/39-enhance-opentaskdetails-and-getnexttask-tools
Return full task details on read_task and get_next_task tool calls
2 parents 489ea71 + 11bff9c commit 9b7bb46

File tree

11 files changed

+36
-72
lines changed

11 files changed

+36
-72
lines changed

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprot
1010
const server = new Server(
1111
{
1212
name: "task-manager-server",
13-
version: "1.3.1"
13+
version: "1.3.2"
1414
},
1515
{
1616
capabilities: {

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "taskqueue-mcp",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "Task Queue MCP Server",
55
"author": "Christopher C. Smith ([email protected])",
66
"main": "dist/index.js",

src/client/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const program = new Command();
1616
program
1717
.name("taskqueue")
1818
.description("CLI for the Task Manager MCP Server")
19-
.version("1.3.1")
19+
.version("1.3.2")
2020
.option(
2121
'-f, --file-path <path>',
2222
'Specify the path to the tasks JSON file. Overrides TASK_MANAGER_FILE_PATH env var.'

src/server/TaskManager.ts

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ export class TaskManager {
280280
}
281281
}
282282

283-
public async getNextTask(projectId: string): Promise<StandardResponse> {
283+
public async getNextTask(projectId: string): Promise<StandardResponse<OpenTaskSuccessData | { message: string }>> {
284284
await this.ensureInitialized();
285285
// Reload from disk to ensure we have the latest data
286286
await this.reloadFromDisk();
@@ -316,15 +316,11 @@ export class TaskManager {
316316
);
317317
}
318318

319-
return {
320-
status: "next_task",
321-
data: {
322-
id: nextTask.id,
323-
title: nextTask.title,
324-
description: nextTask.description,
325-
message: `Next task is ready. Task approval will be required after completion.\n`
326-
}
327-
};
319+
// Return the full task details similar to openTaskDetails
320+
return createSuccessResponse<OpenTaskSuccessData>({
321+
projectId: proj.projectId,
322+
task: { ...nextTask },
323+
});
328324
}
329325

330326
public async approveTaskCompletion(projectId: string, taskId: string): Promise<StandardResponse<ApproveTaskSuccessData>> {
@@ -428,23 +424,14 @@ export class TaskManager {
428424
await this.ensureInitialized();
429425
// Reload from disk to ensure we have the latest data
430426
await this.reloadFromDisk();
431-
427+
432428
for (const proj of this.data.projects) {
433429
const target = proj.tasks.find((t) => t.id === taskId);
434430
if (target) {
431+
// Return only projectId and the full task object
435432
return createSuccessResponse({
436433
projectId: proj.projectId,
437-
initialPrompt: proj.initialPrompt,
438-
projectPlan: proj.projectPlan,
439-
completed: proj.completed,
440-
task: {
441-
id: target.id,
442-
title: target.title,
443-
description: target.description,
444-
status: target.status,
445-
approved: target.approved,
446-
completedDetails: target.completedDetails,
447-
},
434+
task: { ...target }, // Return all fields from the found task
448435
});
449436
}
450437
}

src/server/toolExecutors.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,16 +237,6 @@ const getNextTaskToolExecutor: ToolExecutor = {
237237
async execute(taskManager, args) {
238238
const projectId = validateProjectId(args.projectId);
239239
const result = await taskManager.getNextTask(projectId);
240-
241-
// Ensure backward compatibility with integration tests
242-
if (result.status === "next_task" && result.data) {
243-
return formatToolResponse({
244-
status: "next_task",
245-
task: result.data,
246-
message: result.data.message,
247-
});
248-
}
249-
250240
return formatToolResponse(result);
251241
},
252242
};

src/types/index.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,7 @@ export interface ApproveProjectSuccessData {
111111

112112
export interface OpenTaskSuccessData {
113113
projectId: string;
114-
initialPrompt: string;
115-
projectPlan: string;
116-
completed: boolean;
117-
task: Task; // Use the full Task type
114+
task: Task;
118115
}
119116

120117
export interface ListProjectsSuccessData {
@@ -147,7 +144,7 @@ export interface ReadProjectSuccessData {
147144
initialPrompt: string;
148145
projectPlan: string;
149146
completed: boolean;
150-
tasks: Task[]; // Use the full Task type
147+
tasks: Task[];
151148
}
152149

153150
// --- End NEW Success Data Interfaces ---
@@ -169,17 +166,6 @@ export interface ErrorResponse {
169166
};
170167
}
171168

172-
// Next task response
173-
export interface NextTaskResponse {
174-
status: "next_task";
175-
data: {
176-
id: string;
177-
title: string;
178-
description: string;
179-
message?: string;
180-
};
181-
}
182-
183169
// All tasks done response
184170
export interface AllTasksDoneResponse {
185171
status: "all_tasks_done";
@@ -192,5 +178,4 @@ export interface AllTasksDoneResponse {
192178
export type StandardResponse<T = unknown> =
193179
| SuccessResponse<T>
194180
| ErrorResponse
195-
| NextTaskResponse
196181
| AllTasksDoneResponse;

tests/integration/TaskManager.integration.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ describe('TaskManager Integration', () => {
100100

101101
// 2. Get the next task (first task)
102102
const nextTaskResult = await server.getNextTask(projectId);
103-
expect(nextTaskResult.status).toBe('next_task');
104-
if (nextTaskResult.status === 'next_task' && nextTaskResult.data) {
105-
expect(nextTaskResult.data.id).toBe(taskId1);
103+
expect(nextTaskResult.status).toBe('success');
104+
if (nextTaskResult.status === 'success' && 'task' in nextTaskResult.data) {
105+
expect(nextTaskResult.data.task.id).toBe(taskId1);
106106
}
107107

108108
// 3. Mark the first task as in progress
@@ -123,9 +123,9 @@ describe('TaskManager Integration', () => {
123123

124124
// 6. Get the next task (second task)
125125
const nextTaskResult2 = await server.getNextTask(projectId);
126-
expect(nextTaskResult2.status).toBe('next_task');
127-
if (nextTaskResult2.status === 'next_task' && nextTaskResult2.data) {
128-
expect(nextTaskResult2.data.id).toBe(taskId2);
126+
expect(nextTaskResult2.status).toBe('success');
127+
if (nextTaskResult2.status === 'success' && 'task' in nextTaskResult2.data) {
128+
expect(nextTaskResult2.data.task.id).toBe(taskId2);
129129
}
130130

131131
// 7. Mark the second task as in progress

tests/integration/e2e.integration.test.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ describe('MCP Client Integration', () => {
159159
}) as ToolResponse;
160160
expect(nextTaskResult.isError).toBeFalsy();
161161
const nextTask = JSON.parse((nextTaskResult.content[0] as { text: string }).text);
162-
expect(nextTask.status).toBe("next_task");
163-
expect(nextTask.task).toBeDefined();
164-
const taskId = nextTask.task.id;
162+
expect(nextTask.status).toBe("success");
163+
expect(nextTask.data).toHaveProperty('task');
164+
const taskId = nextTask.data.task.id;
165165
console.log('Got next task with ID:', taskId);
166166

167167
// Mark task as done
@@ -202,7 +202,6 @@ describe('MCP Client Integration', () => {
202202
it('should have accurate version', async () => {
203203
console.log('Testing server version...');
204204
const response = await client.getServerVersion();
205-
expect(response).toBeDefined();
206205
expect(response).toHaveProperty('version');
207206
// Should match package.json version
208207
const packageJson = JSON.parse(
@@ -242,9 +241,9 @@ describe('MCP Client Integration', () => {
242241
}) as ToolResponse;
243242
expect(nextTaskResult.isError).toBeFalsy();
244243
const nextTask = JSON.parse((nextTaskResult.content[0] as { text: string }).text);
245-
expect(nextTask.status).toBe("next_task");
246-
expect(nextTask.task).toBeDefined();
247-
const taskId = nextTask.task.id;
244+
expect(nextTask.status).toBe("success");
245+
expect(nextTask.data).toHaveProperty('task');
246+
const taskId = nextTask.data.task.id;
248247

249248
// Mark task as done - we need to mark it as done using the update_task tool
250249
const markDoneResult = await client.callTool({

tests/unit/TaskManager.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,9 @@ describe('TaskManager', () => {
370370
// Get the next task
371371
const nextTaskResult = await taskManager.getNextTask(projectId);
372372

373-
expect(nextTaskResult.status).toBe('next_task');
374-
if (nextTaskResult.status === 'next_task') {
375-
expect(nextTaskResult.data.id).toBe(createResult.data.tasks[0].id);
373+
expect(nextTaskResult.status).toBe('success');
374+
if (nextTaskResult.status === 'success' && 'task' in nextTaskResult.data) {
375+
expect(nextTaskResult.data.task.id).toBe(createResult.data.tasks[0].id);
376376
}
377377
}
378378
});

0 commit comments

Comments
 (0)