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 update_task_recurrence tool

olozano-6d72dabeab75
diff --git a/apps/docs/core/integrations/mcp.mdx b/apps/docs/core/integrations/mcp.mdx
index 99a2eab7d..681b8265d 100644
--- a/apps/docs/core/integrations/mcp.mdx
+++ b/apps/docs/core/integrations/mcp.mdx
@@ -106,7 +106,7 @@ Both the HTTP endpoint and stdio package expose the same tools:
- Session: `whoami`, `list_workspaces`, `list_workspace_members`, `list_notifications`
- Search: `search`
- Projects: `list_projects`, `get_project`, `create_project`, `update_project`, `list_project_columns`
-- Tasks: `list_tasks`, `get_task`, `get_task_by_ticket_id`, `create_task`, `duplicate_task`, `update_task`, `delete_task`, `move_task`, `update_task_status`, `update_task_assignee`, `update_task_due_date`, `list_task_activity`
+- Tasks: `list_tasks`, `get_task`, `get_task_by_ticket_id`, `create_task`, `duplicate_task`, `update_task`, `delete_task`, `move_task`, `update_task_status`, `update_task_assignee`, `update_task_due_date`, `update_task_recurrence`, `list_task_activity`
- Time entries: `list_task_time_entries`, `get_time_entry`, `create_time_entry`, `update_time_entry`
- Comments: `list_task_comments`, `create_task_comment`, `update_task_comment`, `delete_task_comment`
- Labels: `list_workspace_labels`, `create_label`, `attach_label_to_task`, `detach_label_from_task`, `delete_label`
diff --git a/packages/mcp/README.md b/packages/mcp/README.md
index 471895d9b..7365e764e 100644
--- a/packages/mcp/README.md
+++ b/packages/mcp/README.md
@@ -118,7 +118,7 @@ For headless or sandboxed environments where opening a browser is impractical, s
- Session: `whoami`, `list_workspaces`, `list_workspace_members`, `list_notifications`
- Search: `search`
- Projects: `list_projects`, `get_project`, `create_project`, `update_project`, `list_project_columns`
-- Tasks: `list_tasks`, `get_task`, `get_task_by_ticket_id`, `create_task`, `update_task`, `delete_task`, `move_task`, `update_task_status`, `update_task_assignee`, `update_task_due_date`, `list_task_activity`
+- Tasks: `list_tasks`, `get_task`, `get_task_by_ticket_id`, `create_task`, `update_task`, `delete_task`, `move_task`, `update_task_status`, `update_task_assignee`, `update_task_due_date`, `update_task_recurrence`, `list_task_activity`
- Time entries: `list_task_time_entries`, `get_time_entry`, `create_time_entry`, `update_time_entry`
- Comments: `list_task_comments`, `create_task_comment`, `update_task_comment`, `delete_task_comment`
- Labels: `list_workspace_labels`, `create_label`, `attach_label_to_task`, `detach_label_from_task`, `delete_label`
diff --git a/packages/mcp/src/tools/register.ts b/packages/mcp/src/tools/register.ts
index 9401c3ef9..1604017be 100644
--- a/packages/mcp/src/tools/register.ts
+++ b/packages/mcp/src/tools/register.ts
@@ -777,6 +777,48 @@ export function registerTools(
),
);
+ registerTool(
+ "update_task_recurrence",
+ {
+ description:
+ "Make a task repeat, or omit frequency to stop it repeating. When a repeating task moves into a final column, the next task is created in the first open column, due one step after the completed task's due date.",
+ inputSchema: z.object({
+ taskId: nonEmptyString,
+ frequency: z.enum(["daily", "weekly", "monthly", "yearly"]).optional(),
+ interval: z.number().int().min(1).max(99).default(1),
+ weekdays: z
+ .array(z.number().int().min(0).max(6))
+ .min(1)
+ .max(7)
+ .optional()
+ .describe(
+ "Weekly only: days to repeat on, 0 for Sunday to 6 for Saturday.",
+ ),
+ timeZone: nonEmptyString
+ .default("UTC")
+ .describe(
+ "IANA time zone that keeps the next due date on the same local day.",
+ ),
+ }),
+ },
+ async (args) =>
+ run(() =>
+ client.json(`/api/task/recurrence/${encodeURIComponent(args.taskId)}`, {
+ method: "PUT",
+ body: JSON.stringify({
+ recurrence: args.frequency
+ ? {
+ frequency: args.frequency,
+ interval: args.interval,
+ ...(args.weekdays ? { weekdays: args.weekdays } : {}),
+ timeZone: args.timeZone,
+ }
+ : null,
+ }),
+ }),
+ ),
+ );
+
registerTool(
"list_task_time_entries",
{
diff --git a/tests/api/mcp-tools.test.ts b/tests/api/mcp-tools.test.ts
index e8ff9620c..29e3a24d6 100644
--- a/tests/api/mcp-tools.test.ts
+++ b/tests/api/mcp-tools.test.ts
@@ -167,6 +167,36 @@ describe("MCP tool catalog", () => {
expect(apiFetch).not.toHaveBeenCalled();
});
+ it("sets and stops a task's recurrence", async () => {
+ await call("update_task_recurrence", {
+ taskId: "t1",
+ frequency: "weekly",
+ interval: 2,
+ weekdays: [1, 5],
+ timeZone: "Europe/Madrid",
+ });
+ expect(lastRequest()).toMatchObject({
+ url: "http://api.test/api/task/recurrence/t1",
+ method: "PUT",
+ body: {
+ recurrence: {
+ frequency: "weekly",
+ interval: 2,
+ weekdays: [1, 5],
+ timeZone: "Europe/Madrid",
+ },
+ },
+ });
+
+ await call("update_task_recurrence", { taskId: "t1", frequency: "daily" });
+ expect(lastRequest().body).toEqual({
+ recurrence: { frequency: "daily", interval: 1, timeZone: "UTC" },
+ });
+
+ await call("update_task_recurrence", { taskId: "t1" });
+ expect(lastRequest().body).toEqual({ recurrence: null });
+ });
+
it("reads time entries for a task and by id", async () => {
await call("list_task_time_entries", { taskId: "t1" });
expect(lastRequest().url).toBe("http://api.test/api/time-entry/task/t1");