start_reminder
Set up periodic system notifications to remind users to take breaks and move around, with customizable intervals, messages, and notification settings.
Instructions
启动健康提醒定时器,每隔指定时间弹出系统通知
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| interval | No | 提醒间隔时间(分钟),默认 30 分钟 | |
| message | No | 提醒消息内容 | 该起身活动一下了!久坐对健康不利,建议站起来走动走动。 |
| title | No | 通知标题 | 健康提醒 |
| sound | No | 是否播放提示音 |
Implementation Reference
- src/server/index.ts:117-135 (handler)Core handler function that implements the start_reminder tool logic: clears existing timer, sends immediate notification, and starts periodic reminders using setInterval.function startReminder(config: ReminderConfig) { // 清除现有定时器 if (reminderTimer) { clearInterval(reminderTimer); } currentConfig = { ...config }; const intervalMs = config.interval * 60 * 1000; // 立即发送一次通知 sendNotification(config); // 设置定时器 reminderTimer = setInterval(() => { sendNotification(config); }, intervalMs); console.log(`✓ 健康提醒已启动 - 每 ${config.interval} 分钟提醒一次`); }
- src/server/index.ts:16-21 (schema)TypeScript interface defining the input configuration for the start_reminder tool.interface ReminderConfig { interval: number; // 提醒间隔(分钟) message: string; // 提醒消息 title: string; // 通知标题 sound: boolean; // 是否播放声音 }
- src/server/index.ts:158-186 (registration)Tool registration in the tools array, including name, description, and detailed inputSchema matching ReminderConfig.{ name: "start_reminder", description: "启动健康提醒定时器,每隔指定时间弹出系统通知", inputSchema: { type: "object", properties: { interval: { type: "number", description: "提醒间隔时间(分钟),默认 30 分钟", default: 30, }, message: { type: "string", description: "提醒消息内容", default: "该起身活动一下了!久坐对健康不利,建议站起来走动走动。", }, title: { type: "string", description: "通知标题", default: "健康提醒", }, sound: { type: "boolean", description: "是否播放提示音", default: true, }, }, }, },
- src/server/index.ts:240-262 (handler)MCP tool call handler (switch case) that parses input arguments, constructs ReminderConfig, calls startReminder, and returns success response.case "start_reminder": { const config: ReminderConfig = { interval: (args?.interval as number) || defaultConfig.interval, message: (args?.message as string) || defaultConfig.message, title: (args?.title as string) || defaultConfig.title, sound: args?.sound !== undefined ? (args.sound as boolean) : defaultConfig.sound, }; startReminder(config); return { content: [ { type: "text", text: JSON.stringify({ success: true, message: `健康提醒已启动!每 ${config.interval} 分钟将收到提醒通知。`, config: config, }, null, 2), }, ], }; }