@mcpcn/mcp-notification 1.1.6 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +20 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -95,16 +95,16 @@ class ReminderServer {
95
95
  tools: [
96
96
  {
97
97
  name: 'set_reminder',
98
- description: '设置通知提醒,支持一次性、按间隔循环、每日循环;一次性提醒需提供triggerAt或delaySec,或提供timeOfDay用于推算,优先提供delaySec。',
98
+ description: '设置通知提醒,支持一次性、按间隔循环、每日循环。规则:当用户表述为具体某天/今天/明天/后天/某日期某时间等,请选择repeat=none;优选将具体日期时间直接计算为RFC3339并填入triggerAt,或仅提供timeOfDay让服务端自动推算到最近一次的该时间(若当天已过则推算到明天)。只有当用户明确说“每天/每日/每晚/每早/每隔X时间”时,才使用repeat=dailyrepeat=interval。一次性提醒可提供triggerAt或delaySec,或提供timeOfDay用于推算,优先使用delaySec。',
99
99
  inputSchema: {
100
100
  type: 'object',
101
101
  properties: {
102
102
  content: { type: 'string', minLength: 1, description: '提醒内容,例如 “开会”。' },
103
- repeat: { type: 'string', enum: ['none', 'interval', 'daily'], default: 'none', description: '提醒类型:none 一次性、interval 按间隔、daily 每日。' },
103
+ repeat: { type: 'string', enum: ['none', 'interval', 'daily'], default: 'none', description: '提醒类型:none 一次性(包含“今天/明天/某天”的语义)、interval 按间隔、daily 每日(仅当用户明确要求“每天”时使用)。' },
104
104
  delaySec: { type: 'number', minimum: 1, description: '一次性提醒相对延迟秒数,例如 300 表示5分钟后触发。与triggerAt二选一。' },
105
105
  triggerAt: { type: 'string', description: '一次性提醒绝对时间,RFC3339 格式,例如 2025-11-21T08:00:00+08:00。' },
106
106
  intervalSec: { type: 'number', minimum: 1, description: '按间隔循环的间隔秒数,例如 3600 表示每小时提醒一次。仅repeat=interval时必需。' },
107
- timeOfDay: { type: 'string', pattern: '^\\d{1,2}:\\d{2}(:\\d{2})?$', description: '一天中的时间,格式 HH:mm 或 HH:mm:ss,例如 08:00 或 08:00:00。repeat=daily时必需;repeat=none且未提供triggerAt/delaySec时用于推算。' },
107
+ timeOfDay: { type: 'string', pattern: '^\\d{1,2}:\\d{2}(:\\d{2})?$', description: '一天中的时间,格式 HH:mm 或 HH:mm:ss,例如 08:00 或 08:00:00。repeat=daily时必需;repeat=none且未提供triggerAt/delaySec时用于推算。典型用法:用户说“明天早上8点”,请选择repeat=none并设置timeOfDay="08:00",服务端会自动推算到最近的08:00。' },
108
108
  tzOffsetMin: { type: 'number', description: '时区偏移分钟,例如北京为 480;不提供时默认使用本机时区。' },
109
109
  chatSessionId: { type: 'string', minLength: 1, description: '设备会话标识,由宿主环境传入。' },
110
110
  },
@@ -131,6 +131,7 @@ class ReminderServer {
131
131
  examples: [
132
132
  { content: '开会', repeat: 'none', triggerAt: '2025-11-21T08:00:00+08:00' },
133
133
  { content: '喝水', repeat: 'none', delaySec: 300 },
134
+ { content: '出发去10号线', repeat: 'none', timeOfDay: '08:00', tzOffsetMin: 480 },
134
135
  { content: '站立休息', repeat: 'interval', intervalSec: 1800 },
135
136
  { content: '打卡', repeat: 'daily', timeOfDay: '09:00', tzOffsetMin: 480 },
136
137
  ],
@@ -311,12 +312,23 @@ class ReminderServer {
311
312
  const mm = String(abs % 60).padStart(2, '0');
312
313
  return `${sign}${hh}:${mm}`;
313
314
  };
314
- const toLocal = (iso) => {
315
- if (!iso)
316
- return iso;
317
- const d = new Date(iso);
315
+ const toLocal = (v) => {
316
+ if (v === undefined || v === null)
317
+ return v;
318
+ let ms;
319
+ if (typeof v === 'number') {
320
+ ms = v > 1e12 ? v : v * 1000;
321
+ }
322
+ else if (typeof v === 'string') {
323
+ const s = v.trim();
324
+ if (/^\d{10}$/.test(s))
325
+ ms = parseInt(s, 10) * 1000;
326
+ else if (/^\d{13}$/.test(s))
327
+ ms = parseInt(s, 10);
328
+ }
329
+ const d = ms !== undefined ? new Date(ms) : new Date(v);
318
330
  if (isNaN(d.getTime()))
319
- return iso;
331
+ return v;
320
332
  const y = d.getFullYear();
321
333
  const m = String(d.getMonth() + 1).padStart(2, '0');
322
334
  const day = String(d.getDate()).padStart(2, '0');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpcn/mcp-notification",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "系统通知MCP服务器",
5
5
  "packageManager": "yarn@1.22.22",
6
6
  "main": "dist/index.js",