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.

fix(mcp): require a time zone when setting a repeat rule

olozano-8018f3411cf8
diff --git a/packages/mcp/src/tools/register.ts b/packages/mcp/src/tools/register.ts
index 1604017be..fae5196cb 100644
--- a/packages/mcp/src/tools/register.ts
+++ b/packages/mcp/src/tools/register.ts
@@ -795,14 +795,16 @@ export function registerTools(
"Weekly only: days to repeat on, 0 for Sunday to 6 for Saturday.",
),
timeZone: nonEmptyString
- .default("UTC")
+ .optional()
.describe(
- "IANA time zone that keeps the next due date on the same local day.",
+ "Required with frequency: the user's IANA time zone, such as Europe/Madrid. Weekdays and month ends are matched in this zone, so a wrong one moves the next task to another local day.",
),
}),
},
- async (args) =>
- run(() =>
+ async (args) => {
+ if (args.frequency && !args.timeZone)
+ return errorResult("timeZone is required with frequency");
+ return run(() =>
client.json(`/api/task/recurrence/${encodeURIComponent(args.taskId)}`, {
method: "PUT",
body: JSON.stringify({
@@ -816,7 +818,8 @@ export function registerTools(
: null,
}),
}),
- ),
+ );
+ },
);
registerTool(
diff --git a/tests/api/mcp-tools.test.ts b/tests/api/mcp-tools.test.ts
index 29e3a24d6..bde8b1da9 100644
--- a/tests/api/mcp-tools.test.ts
+++ b/tests/api/mcp-tools.test.ts
@@ -188,10 +188,22 @@ describe("MCP tool catalog", () => {
},
});
- await call("update_task_recurrence", { taskId: "t1", frequency: "daily" });
+ await call("update_task_recurrence", {
+ taskId: "t1",
+ frequency: "daily",
+ timeZone: "Asia/Tokyo",
+ });
expect(lastRequest().body).toEqual({
- recurrence: { frequency: "daily", interval: 1, timeZone: "UTC" },
+ recurrence: { frequency: "daily", interval: 1, timeZone: "Asia/Tokyo" },
+ });
+
+ const requests = apiFetch.mock.calls.length;
+ const missingZone = await call("update_task_recurrence", {
+ taskId: "t1",
+ frequency: "daily",
});
+ expect(missingZone.isError).toBe(true);
+ expect(apiFetch.mock.calls.length).toBe(requests);
await call("update_task_recurrence", { taskId: "t1" });
expect(lastRequest().body).toEqual({ recurrence: null });