intervals-icu-mcp-server 0.1.0

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.
@@ -0,0 +1,5 @@
1
+ import type { Activity, Wellness, Event } from "./client.js";
2
+ export declare function formatActivity(a: Activity): string;
3
+ export declare function formatWellness(date: string, w: Wellness): string;
4
+ export declare function formatEvent(e: Event): string;
5
+ export declare function formatIntervalRow(interval: Record<string, unknown>, idx: number): string;
package/dist/format.js ADDED
@@ -0,0 +1,92 @@
1
+ function n(v, unit = "") {
2
+ if (v == null)
3
+ return "N/A";
4
+ return `${v}${unit}`;
5
+ }
6
+ export function formatActivity(a) {
7
+ const startTime = a.startTime
8
+ ? new Date(a.startTime).toLocaleString()
9
+ : "Unknown";
10
+ const lines = [
11
+ `**${a.name ?? "Unnamed"}** (${a.id})`,
12
+ `Type: ${n(a.type)} | Date: ${startTime}`,
13
+ `Distance: ${n(a.distance, " m")} | Duration: ${n(a.duration, " s")} | Moving: ${n(a.moving_time, " s")}`,
14
+ `Elevation: ${n(a.elevationGain, " m")}`,
15
+ "",
16
+ "Power:",
17
+ ` Avg: ${n(a.avgPower, " W")} | Weighted Avg: ${n(a.icu_weighted_avg_watts, " W")} | FTP: ${n(a.icu_ftp, " W")}`,
18
+ ` Training Load: ${n(a.trainingLoad)} | Intensity: ${n(a.icu_intensity)}`,
19
+ "",
20
+ "Heart Rate:",
21
+ ` Avg: ${n(a.avgHr, " bpm")} | Max: ${n(a.max_heartrate, " bpm")}`,
22
+ "",
23
+ "Other:",
24
+ ` Cadence: ${n(a.average_cadence, " rpm")} | Calories: ${n(a.calories)} | Speed: ${n(a.average_speed, " m/s")}`,
25
+ ` Temp: ${n(a.average_temp, "°C")} | Trainer: ${a.trainer ? "Yes" : "No"}`,
26
+ ` RPE: ${n(a.perceived_exertion)}/10 | Feel: ${n(a.feel)}/10`,
27
+ "",
28
+ "Fitness:",
29
+ ` CTL: ${n(a.icu_ctl)} | ATL: ${n(a.icu_atl)} | TRIMP: ${n(a.trimp)}`,
30
+ ];
31
+ if (a.description)
32
+ lines.push("", `Description: ${a.description}`);
33
+ return lines.join("\n");
34
+ }
35
+ export function formatWellness(date, w) {
36
+ const sleepHours = w.sleepSecs != null ? (w.sleepSecs / 3600).toFixed(1) + " h" : "N/A";
37
+ return [
38
+ `**${date}**`,
39
+ "",
40
+ "Training:",
41
+ ` CTL: ${n(w.ctl)} | ATL: ${n(w.atl)}`,
42
+ "",
43
+ "Vitals:",
44
+ ` Weight: ${n(w.weight, " kg")} | Resting HR: ${n(w.restingHR, " bpm")}`,
45
+ ` HRV: ${n(w.hrv)} | HRV SDNN: ${n(w.hrvSDNN)}`,
46
+ ` SpO2: ${n(w.spO2, "%")} | VO2max: ${n(w.vo2max)} | Body Fat: ${n(w.bodyFat, "%")}`,
47
+ "",
48
+ "Sleep & Recovery:",
49
+ ` Sleep: ${sleepHours} | Score: ${n(w.sleepScore)}/100 | Quality: ${n(w.sleepQuality)}/10`,
50
+ ` Readiness: ${n(w.readiness)}/10`,
51
+ "",
52
+ "Subjective:",
53
+ ` Soreness: ${n(w.soreness)}/10 | Fatigue: ${n(w.fatigue)}/10 | Stress: ${n(w.stress)}/10`,
54
+ ` Mood: ${n(w.mood)}/10 | Motivation: ${n(w.motivation)}/10`,
55
+ "",
56
+ "Nutrition:",
57
+ ` Calories: ${n(w.kcalConsumed, " kcal")} | Steps: ${n(w.steps)}`,
58
+ w.comments ? `\nComments: ${w.comments}` : "",
59
+ ]
60
+ .filter((l) => l !== undefined)
61
+ .join("\n")
62
+ .trimEnd();
63
+ }
64
+ export function formatEvent(e) {
65
+ const type = e.race ? "Race" : e.workout ? "Workout" : "Event";
66
+ return [
67
+ `**${e.name ?? "Unnamed"}** (${e.id})`,
68
+ `Type: ${type} | Date: ${e.date ?? "Unknown"}`,
69
+ e.description ? `Description: ${e.description}` : "",
70
+ e.priority ? `Priority: ${e.priority}` : "",
71
+ ]
72
+ .filter(Boolean)
73
+ .join("\n");
74
+ }
75
+ export function formatIntervalRow(interval, idx) {
76
+ const label = interval["label"] ?? `Interval ${idx}`;
77
+ const type = interval["type"] ?? "Unknown";
78
+ const elapsed = interval["elapsed_time"] ?? 0;
79
+ const distance = interval["distance"] ?? 0;
80
+ const avgW = interval["average_watts"] ?? 0;
81
+ const wAvg = interval["weighted_average_watts"] ?? 0;
82
+ const maxW = interval["max_watts"] ?? 0;
83
+ const avgHr = interval["average_heartrate"] ?? 0;
84
+ const maxHr = interval["max_heartrate"] ?? 0;
85
+ const tl = interval["training_load"] ?? 0;
86
+ return [
87
+ `[${idx}] ${label} (${type})`,
88
+ ` Duration: ${elapsed}s | Distance: ${distance}m`,
89
+ ` Power: avg ${avgW}W, w.avg ${wAvg}W, max ${maxW}W | TL: ${tl}`,
90
+ ` HR: avg ${avgHr}, max ${maxHr} bpm`,
91
+ ].join("\n");
92
+ }
@@ -0,0 +1 @@
1
+ import "dotenv/config";