sunderos-mcp 0.2.0 → 0.2.2
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.
- package/dist/index.js +6 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ function getErrorMessage(err) {
|
|
|
21
21
|
// ---------------------------------------------------------------------------
|
|
22
22
|
const server = new McpServer({
|
|
23
23
|
name: 'sunderos',
|
|
24
|
-
version: '0.2.
|
|
24
|
+
version: '0.2.1',
|
|
25
25
|
});
|
|
26
26
|
// ===========================
|
|
27
27
|
// EXERCISES
|
|
@@ -353,18 +353,19 @@ server.tool('delete_program', 'Delete a training program and all its scheduled d
|
|
|
353
353
|
server.tool('get_workout_history', 'Get recent workout sessions with stats (duration, volume, exercise count)', {
|
|
354
354
|
limit: z.number().min(1).max(50).default(10).optional(),
|
|
355
355
|
}, async ({ limit }) => {
|
|
356
|
-
const
|
|
356
|
+
const res = await api.get(`/api/sessions?limit=${limit ?? 10}`);
|
|
357
|
+
const sessions = res.sessions;
|
|
357
358
|
if (sessions.length === 0)
|
|
358
359
|
return { content: [{ type: 'text', text: 'No completed workouts yet.' }] };
|
|
359
360
|
const text = sessions.map((s) => {
|
|
360
|
-
const dur = s.finishedAt && s.startedAt
|
|
361
|
+
const dur = s.durationMinutes != null ? Math.round(s.durationMinutes) : (s.finishedAt && s.startedAt
|
|
361
362
|
? Math.round((new Date(s.finishedAt).getTime() - new Date(s.startedAt).getTime()) / 60000)
|
|
362
|
-
: '?';
|
|
363
|
+
: '?');
|
|
363
364
|
const tags = s.tags && s.tags.length > 0 ? ` [${s.tags.join(', ')}]` : '';
|
|
364
365
|
const vol = s.totalVolume || s.volume || 0;
|
|
365
366
|
const exCount = s.exerciseCount || s.exercises?.length || 0;
|
|
366
367
|
const setCount = s.totalSets || s.setCount || 0;
|
|
367
|
-
return `• **${formatDate(s.startedAt)}** — ${s.templateName || s.name || 'Quick Workout'}${tags}\n ${exCount} exercises, ${setCount} sets, ${Math.round(vol).toLocaleString()} lb volume, ${dur} min${s.notes ? '\n Notes: ' + s.notes : ''}`;
|
|
368
|
+
return `• **${formatDate(s.startedAt)}** (id: ${s.id}) — ${s.templateName || s.name || 'Quick Workout'}${tags}\n ${exCount} exercises, ${setCount} sets, ${Math.round(vol).toLocaleString()} lb volume, ${dur} min${s.notes ? '\n Notes: ' + s.notes : ''}`;
|
|
368
369
|
}).join('\n');
|
|
369
370
|
return { content: [{ type: 'text', text: `Last ${sessions.length} workout(s):\n\n${text}` }] };
|
|
370
371
|
});
|