Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat(mcp): add task-relation and label-delete tools

dmtrTmdfc2d9b0f472
diff --git a/apps/api/src/mcp/tools.ts b/apps/api/src/mcp/tools.ts
index 1dddad356..400252a9e 100644
--- a/apps/api/src/mcp/tools.ts
+++ b/apps/api/src/mcp/tools.ts
@@ -579,4 +579,72 @@ export function registerMcpTools(
}),
),
);
+
+ server.registerTool(
+ "create_task_relation",
+ {
+ description:
+ "Create a relation between two tasks. relationType: 'subtask' (sourceTaskId is the parent, targetTaskId the child), 'blocks' (sourceTaskId blocks targetTaskId), or 'related' (bidirectional).",
+ inputSchema: z.object({
+ sourceTaskId: nonEmptyString,
+ targetTaskId: nonEmptyString,
+ relationType: z.enum(["subtask", "blocks", "related"]),
+ }),
+ },
+ async (args) =>
+ run(() =>
+ client.json("/api/task-relation", {
+ method: "POST",
+ body: JSON.stringify({
+ sourceTaskId: args.sourceTaskId,
+ targetTaskId: args.targetTaskId,
+ relationType: args.relationType,
+ }),
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "get_task_relations",
+ {
+ description:
+ "List all relations (subtask/blocks/related) involving a task.",
+ inputSchema: z.object({ taskId: nonEmptyString }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/task-relation/${encodeURIComponent(args.taskId)}`, {
+ method: "GET",
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "delete_task_relation",
+ {
+ description: "Delete a task relation by its relation ID.",
+ inputSchema: z.object({ id: nonEmptyString }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/task-relation/${encodeURIComponent(args.id)}`, {
+ method: "DELETE",
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "delete_label",
+ {
+ description:
+ "Delete a workspace label by ID (removes it from all tasks).",
+ inputSchema: z.object({ id: nonEmptyString }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/label/${encodeURIComponent(args.id)}`, {
+ method: "DELETE",
+ }),
+ ),
+ );
}
diff --git a/packages/mcp/src/tools/register.ts b/packages/mcp/src/tools/register.ts
index c7bf77a58..6e43ba99b 100644
--- a/packages/mcp/src/tools/register.ts
+++ b/packages/mcp/src/tools/register.ts
@@ -458,4 +458,72 @@ export function registerTools(
}),
),
);
+
+ server.registerTool(
+ "create_task_relation",
+ {
+ description:
+ "Create a relation between two tasks. relationType: 'subtask' (sourceTaskId is the parent, targetTaskId the child), 'blocks' (sourceTaskId blocks targetTaskId), or 'related' (bidirectional).",
+ inputSchema: z.object({
+ sourceTaskId: nonEmptyString,
+ targetTaskId: nonEmptyString,
+ relationType: z.enum(["subtask", "blocks", "related"]),
+ }),
+ },
+ async (args) =>
+ run(() =>
+ client.json("/api/task-relation", {
+ method: "POST",
+ body: JSON.stringify({
+ sourceTaskId: args.sourceTaskId,
+ targetTaskId: args.targetTaskId,
+ relationType: args.relationType,
+ }),
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "get_task_relations",
+ {
+ description:
+ "List all relations (subtask/blocks/related) involving a task.",
+ inputSchema: z.object({ taskId: nonEmptyString }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/task-relation/${encodeURIComponent(args.taskId)}`, {
+ method: "GET",
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "delete_task_relation",
+ {
+ description: "Delete a task relation by its relation ID.",
+ inputSchema: z.object({ id: nonEmptyString }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/task-relation/${encodeURIComponent(args.id)}`, {
+ method: "DELETE",
+ }),
+ ),
+ );
+
+ server.registerTool(
+ "delete_label",
+ {
+ description:
+ "Delete a workspace label by ID (removes it from all tasks).",
+ inputSchema: z.object({ id: nonEmptyString }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/label/${encodeURIComponent(args.id)}`, {
+ method: "DELETE",
+ }),
+ ),
+ );
}