@cognistore/mcp-server 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +62 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1427,7 +1427,32 @@ var KnowledgeService = class {
|
|
|
1427
1427
|
};
|
|
1428
1428
|
}
|
|
1429
1429
|
deletePlanTask(id) {
|
|
1430
|
-
|
|
1430
|
+
const planId = this.repository.getTaskPlanId(id) ?? "";
|
|
1431
|
+
const deleted = this.repository.deletePlanTask(id);
|
|
1432
|
+
if (!deleted) {
|
|
1433
|
+
return { deleted: false, planId: "", planStatus: "unknown", progress: "0/0 completed", autoActions: [] };
|
|
1434
|
+
}
|
|
1435
|
+
const autoActions = [];
|
|
1436
|
+
if (planId) {
|
|
1437
|
+
const remaining = this.repository.listPlanTasks(planId);
|
|
1438
|
+
const incomplete = this.repository.countIncompleteTasks(planId);
|
|
1439
|
+
const plan = this.repository.getPlanById(planId);
|
|
1440
|
+
if (remaining.length > 0 && incomplete === 0 && plan?.status === "active") {
|
|
1441
|
+
this.repository.updatePlan(planId, { status: "completed" });
|
|
1442
|
+
autoActions.push("Plan auto-completed \u2014 all remaining tasks done");
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
const currentPlan = planId ? this.repository.getPlanById(planId) : null;
|
|
1446
|
+
const allTasks = planId ? this.repository.listPlanTasks(planId) : [];
|
|
1447
|
+
const completedCount = allTasks.filter((t) => t.status === "completed").length;
|
|
1448
|
+
const progress = `${completedCount}/${allTasks.length} completed`;
|
|
1449
|
+
return {
|
|
1450
|
+
deleted: true,
|
|
1451
|
+
planId,
|
|
1452
|
+
planStatus: currentPlan?.status ?? "unknown",
|
|
1453
|
+
progress,
|
|
1454
|
+
autoActions
|
|
1455
|
+
};
|
|
1431
1456
|
}
|
|
1432
1457
|
listPlanTasks(planId) {
|
|
1433
1458
|
return this.repository.listPlanTasks(planId).map((r) => this.toPlanTask(r));
|
|
@@ -3570,13 +3595,14 @@ function createServer(sdk) {
|
|
|
3570
3595
|
);
|
|
3571
3596
|
server.tool(
|
|
3572
3597
|
"updatePlanTask",
|
|
3573
|
-
|
|
3598
|
+
'Update a task status. Plan auto-activates on first in_progress and auto-completes when all tasks are done. Set "position" to reorder the task within the plan.',
|
|
3574
3599
|
{
|
|
3575
3600
|
taskId: z3.string().describe("UUID of the task"),
|
|
3576
3601
|
status: z3.enum(["pending", "in_progress", "completed"]).optional().describe("New status"),
|
|
3577
3602
|
description: z3.string().optional().describe("New description"),
|
|
3578
3603
|
priority: z3.enum(["low", "medium", "high"]).optional().describe("New priority"),
|
|
3579
|
-
notes: z3.string().nullable().optional().describe("Notes about progress or blockers")
|
|
3604
|
+
notes: z3.string().nullable().optional().describe("Notes about progress or blockers"),
|
|
3605
|
+
position: z3.number().optional().describe("New 0-based position; reorders the task within the plan (tasks are listed by position ascending)")
|
|
3580
3606
|
},
|
|
3581
3607
|
WRITE,
|
|
3582
3608
|
async (params) => {
|
|
@@ -3617,6 +3643,39 @@ function createServer(sdk) {
|
|
|
3617
3643
|
return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
|
|
3618
3644
|
}
|
|
3619
3645
|
);
|
|
3646
|
+
server.tool(
|
|
3647
|
+
"deletePlanTask",
|
|
3648
|
+
"Remove a task from a plan. If the remaining tasks are all completed (and at least one remains), the plan auto-completes. Returns the updated plan context.",
|
|
3649
|
+
{
|
|
3650
|
+
taskId: z3.string().describe("UUID of the task to remove")
|
|
3651
|
+
},
|
|
3652
|
+
DESTRUCTIVE,
|
|
3653
|
+
async (params) => {
|
|
3654
|
+
const result = sdk.deletePlanTask(params.taskId);
|
|
3655
|
+
if (!result.deleted) return { content: [{ type: "text", text: JSON.stringify({ error: "not_found", type: "plan_task", id: params.taskId }) }] };
|
|
3656
|
+
const response = {
|
|
3657
|
+
deleted: true,
|
|
3658
|
+
id: params.taskId,
|
|
3659
|
+
plan: { id: result.planId, status: result.planStatus, progress: result.progress },
|
|
3660
|
+
...result.autoActions.length > 0 ? { autoActions: result.autoActions } : {},
|
|
3661
|
+
reminder: `Plan ID: "${result.planId}". Pass this planId to addKnowledge calls for output linking.`
|
|
3662
|
+
};
|
|
3663
|
+
return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
|
|
3664
|
+
}
|
|
3665
|
+
);
|
|
3666
|
+
server.tool(
|
|
3667
|
+
"archivePlan",
|
|
3668
|
+
'Archive a plan (status \u2192 "archived") to take it out of active circulation. Reversible \u2014 re-activate via updatePlan. Preferred over deletion: keeps the plan and its linked knowledge.',
|
|
3669
|
+
{
|
|
3670
|
+
planId: z3.string().describe("UUID of the plan to archive")
|
|
3671
|
+
},
|
|
3672
|
+
WRITE,
|
|
3673
|
+
async (params) => {
|
|
3674
|
+
const result = sdk.updatePlan(params.planId, { status: "archived" });
|
|
3675
|
+
if (!result) return { content: [{ type: "text", text: JSON.stringify({ error: "not_found", type: "plan", id: params.planId }) }] };
|
|
3676
|
+
return { content: [{ type: "text", text: JSON.stringify({ archived: true, id: result.id, status: result.status }, null, 2) }] };
|
|
3677
|
+
}
|
|
3678
|
+
);
|
|
3620
3679
|
server.tool(
|
|
3621
3680
|
"listPlanTasks",
|
|
3622
3681
|
"List all tasks for a plan, ordered by position. Shows progress.",
|