You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scheduler: add phantom_schedule update action so editing a job preserves run history (#86)
Adds `action: "update"` to phantom_schedule. The caller can change
`task`, `description`, `schedule`, `delivery`, or `enabled` on an
existing job by jobId or name. The history columns (last_run_at,
last_run_status, last_run_duration_ms, last_run_error, run_count,
consecutive_errors, created_at) and the stable jobId are preserved.
If schedule changes, next_run_at is recomputed via the same
computeNextRunAt path resumeJob uses, then armTimer() so an earlier
next-fire wakes the timer in time.
Closes#86.
constTOOL_DESCRIPTION=`Create, list, delete, or trigger scheduled tasks. Lets you set up recurring jobs, one-shot reminders, and automated reports.
15
+
constTOOL_DESCRIPTION=`Create, list, update, delete, or trigger scheduled tasks. Lets you set up recurring jobs, one-shot reminders, and automated reports.
16
16
17
17
Actions:
18
18
- create: Create a new scheduled task. Returns the job id and next run time. Rejects invalid schedules, past timestamps, duplicate names, task text over 32 KB, and delivery targets that are not "owner", a channel id (C...), or a user id (U...).
19
19
- list: List all scheduled tasks with status and next run time. Corrupt rows are logged and skipped.
20
+
- update: Edit task, description, schedule, delivery, or enabled on an existing job by jobId or name. Run history (last_run_at, run_count, consecutive_errors) and the stable jobId are preserved. If schedule changes, next_run_at is recomputed. Requires at least one field; name is not editable.
20
21
- delete: Remove a scheduled task by jobId or by name (case insensitive).
21
22
- run: Trigger a task immediately. Only runs when status is active and no other job is currently executing. Returns the task output.
22
23
@@ -59,19 +60,25 @@ export function createSchedulerToolServer(scheduler: Scheduler): McpSdkServerCon
59
60
TOOL_DESCRIPTION,
60
61
{
61
62
action: z
62
-
.enum(["create","list","delete","run"])
63
+
.enum(["create","list","update","delete","run"])
63
64
.describe(
64
-
"create: new scheduled task. list: enumerate tasks. delete: remove by jobId or name. run: trigger immediately (only when status=active and scheduler is idle).",
65
+
"create: new scheduled task. list: enumerate tasks. update: edit user-authored fields by jobId or name (preserves run history). delete: remove by jobId or name. run: trigger immediately (only when status=active and scheduler is idle).",
65
66
),
66
-
name: z.string().optional().describe("Job name (required for create)"),
67
+
name: z.string().optional().describe("Job name (required for create; lookup key for update, delete, run)"),
0 commit comments