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
Copy file name to clipboardExpand all lines: mcp/server.mjs
+118-1Lines changed: 118 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,61 @@ const resources = {
78
78
},
79
79
};
80
80
81
+
constrecipes={
82
+
'wall-clock': 'Use useTimer({ autoStart: true }) and render new Date(timer.now). Keep locale and timezone formatting in userland.',
83
+
stopwatch: 'Use useTimer({ updateIntervalMs: 100 }). Render timer.elapsedMilliseconds and wire start, pause, resume, restart, and reset to buttons.',
84
+
'absolute-countdown': 'Use timer.now for server deadlines: const remainingMs = Math.max(0, expiresAt - timer.now). Use endWhen: snapshot => snapshot.now >= expiresAt.',
85
+
'pausable-countdown': 'Use timer.elapsedMilliseconds for active elapsed time: const remainingMs = durationMs - timer.elapsedMilliseconds. Paused time is excluded.',
86
+
'otp-resend': 'Use a duration countdown. Disable the resend button while timer.isRunning and enable it after timer.isEnded or remainingMs <= 0.',
'autosave-heartbeat': 'Use useScheduledTimer with a schedule every 5000-15000ms. Keep retry/backoff and request state in app code.',
89
+
'timer-group': 'Import useTimerGroup from @crup/react-timer-hook/group for many keyed timers that each need independent pause, resume, cancel, restart, or onEnd.',
90
+
'per-item-polling': 'Use useTimerGroup with item schedules when each row needs independent polling cadence or cancel conditions.',
91
+
diagnostics: 'Import consoleTimerDiagnostics from @crup/react-timer-hook/diagnostics and pass diagnostics only while debugging.',
92
+
};
93
+
94
+
consttools=[
95
+
{
96
+
name: 'get_api_docs',
97
+
description: 'Return the compact API notes for @crup/react-timer-hook.',
98
+
inputSchema: {
99
+
type: 'object',
100
+
properties: {},
101
+
additionalProperties: false,
102
+
},
103
+
},
104
+
{
105
+
name: 'get_recipe',
106
+
description: 'Return guidance for a named recipe or use case.',
107
+
inputSchema: {
108
+
type: 'object',
109
+
properties: {
110
+
name: {
111
+
type: 'string',
112
+
description: `Recipe name. Known values: ${Object.keys(recipes).join(', ')}.`,
113
+
},
114
+
},
115
+
required: ['name'],
116
+
additionalProperties: false,
117
+
},
118
+
},
119
+
{
120
+
name: 'search_docs',
121
+
description: 'Search API and recipe notes for a query.',
122
+
inputSchema: {
123
+
type: 'object',
124
+
properties: {
125
+
query: {
126
+
type: 'string',
127
+
description: 'Search query such as countdown, polling, group, diagnostics, or OTP.',
0 commit comments