hevy-mcp 1.10.16 → 1.11.10
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/README.md +24 -20
- package/dist/index.js +398 -377
- package/dist/index.js.map +1 -1
- package/package.json +39 -34
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
9
9
|
|
|
10
10
|
// package.json
|
|
11
11
|
var name = "hevy-mcp";
|
|
12
|
-
var version = "1.
|
|
12
|
+
var version = "1.11.9";
|
|
13
13
|
|
|
14
14
|
// src/tools/folders.ts
|
|
15
15
|
import { z } from "zod";
|
|
@@ -198,6 +198,11 @@ function registerFolderTools(server2, hevyClient2) {
|
|
|
198
198
|
},
|
|
199
199
|
withErrorHandling(
|
|
200
200
|
async ({ page, pageSize }) => {
|
|
201
|
+
if (!hevyClient2) {
|
|
202
|
+
throw new Error(
|
|
203
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
204
|
+
);
|
|
205
|
+
}
|
|
201
206
|
const data = await hevyClient2.getRoutineFolders({
|
|
202
207
|
page,
|
|
203
208
|
pageSize
|
|
@@ -222,6 +227,11 @@ function registerFolderTools(server2, hevyClient2) {
|
|
|
222
227
|
folderId: z.string().min(1)
|
|
223
228
|
},
|
|
224
229
|
withErrorHandling(async ({ folderId }) => {
|
|
230
|
+
if (!hevyClient2) {
|
|
231
|
+
throw new Error(
|
|
232
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
233
|
+
);
|
|
234
|
+
}
|
|
225
235
|
const data = await hevyClient2.getRoutineFolder(folderId);
|
|
226
236
|
if (!data) {
|
|
227
237
|
return createEmptyResponse(
|
|
@@ -239,6 +249,11 @@ function registerFolderTools(server2, hevyClient2) {
|
|
|
239
249
|
name: z.string().min(1)
|
|
240
250
|
},
|
|
241
251
|
withErrorHandling(async ({ name: name2 }) => {
|
|
252
|
+
if (!hevyClient2) {
|
|
253
|
+
throw new Error(
|
|
254
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
255
|
+
);
|
|
256
|
+
}
|
|
242
257
|
const data = await hevyClient2.createRoutineFolder({
|
|
243
258
|
routine_folder: {
|
|
244
259
|
title: name2
|
|
@@ -269,6 +284,11 @@ function registerRoutineTools(server2, hevyClient2) {
|
|
|
269
284
|
pageSize: z2.coerce.number().int().gte(1).lte(10).default(5)
|
|
270
285
|
},
|
|
271
286
|
withErrorHandling(async (args2) => {
|
|
287
|
+
if (!hevyClient2) {
|
|
288
|
+
throw new Error(
|
|
289
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
290
|
+
);
|
|
291
|
+
}
|
|
272
292
|
const { page, pageSize } = args2;
|
|
273
293
|
const data = await hevyClient2.getRoutines({
|
|
274
294
|
page,
|
|
@@ -290,6 +310,11 @@ function registerRoutineTools(server2, hevyClient2) {
|
|
|
290
310
|
routineId: z2.string().min(1)
|
|
291
311
|
},
|
|
292
312
|
withErrorHandling(async ({ routineId }) => {
|
|
313
|
+
if (!hevyClient2) {
|
|
314
|
+
throw new Error(
|
|
315
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
316
|
+
);
|
|
317
|
+
}
|
|
293
318
|
const data = await hevyClient2.getRoutineById(String(routineId));
|
|
294
319
|
if (!data || !data.routine) {
|
|
295
320
|
return createEmptyResponse(`Routine with ID ${routineId} not found`);
|
|
@@ -325,6 +350,11 @@ function registerRoutineTools(server2, hevyClient2) {
|
|
|
325
350
|
)
|
|
326
351
|
},
|
|
327
352
|
withErrorHandling(async (args2) => {
|
|
353
|
+
if (!hevyClient2) {
|
|
354
|
+
throw new Error(
|
|
355
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
356
|
+
);
|
|
357
|
+
}
|
|
328
358
|
const { title, folderId, notes, exercises } = args2;
|
|
329
359
|
const data = await hevyClient2.createRoutine({
|
|
330
360
|
routine: {
|
|
@@ -390,6 +420,11 @@ function registerRoutineTools(server2, hevyClient2) {
|
|
|
390
420
|
)
|
|
391
421
|
},
|
|
392
422
|
withErrorHandling(async (args2) => {
|
|
423
|
+
if (!hevyClient2) {
|
|
424
|
+
throw new Error(
|
|
425
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
426
|
+
);
|
|
427
|
+
}
|
|
393
428
|
const { routineId, title, notes, exercises } = args2;
|
|
394
429
|
const data = await hevyClient2.updateRoutine(routineId, {
|
|
395
430
|
routine: {
|
|
@@ -441,6 +476,11 @@ function registerTemplateTools(server2, hevyClient2) {
|
|
|
441
476
|
},
|
|
442
477
|
withErrorHandling(
|
|
443
478
|
async ({ page, pageSize }) => {
|
|
479
|
+
if (!hevyClient2) {
|
|
480
|
+
throw new Error(
|
|
481
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
482
|
+
);
|
|
483
|
+
}
|
|
444
484
|
const data = await hevyClient2.getExerciseTemplates({
|
|
445
485
|
page,
|
|
446
486
|
pageSize
|
|
@@ -466,6 +506,11 @@ function registerTemplateTools(server2, hevyClient2) {
|
|
|
466
506
|
},
|
|
467
507
|
withErrorHandling(
|
|
468
508
|
async ({ exerciseTemplateId }) => {
|
|
509
|
+
if (!hevyClient2) {
|
|
510
|
+
throw new Error(
|
|
511
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
512
|
+
);
|
|
513
|
+
}
|
|
469
514
|
const data = await hevyClient2.getExerciseTemplate(exerciseTemplateId);
|
|
470
515
|
if (!data) {
|
|
471
516
|
return createEmptyResponse(
|
|
@@ -486,9 +531,9 @@ import { z as z40 } from "zod";
|
|
|
486
531
|
// src/generated/client/schemas/deletedWorkoutSchema.ts
|
|
487
532
|
import { z as z4 } from "zod";
|
|
488
533
|
var deletedWorkoutSchema = z4.object({
|
|
489
|
-
type: z4.string().describe("Indicates the type of the event (deleted)"),
|
|
490
|
-
id: z4.string().describe("The unique identifier of the deleted workout"),
|
|
491
|
-
deleted_at: z4.string().describe("A date string indicating when the workout was deleted")
|
|
534
|
+
"type": z4.string().describe("Indicates the type of the event (deleted)"),
|
|
535
|
+
"id": z4.string().describe("The unique identifier of the deleted workout"),
|
|
536
|
+
"deleted_at": z4.optional(z4.string().describe("A date string indicating when the workout was deleted"))
|
|
492
537
|
});
|
|
493
538
|
|
|
494
539
|
// src/generated/client/schemas/deleteV1WebhookSubscriptionSchema.ts
|
|
@@ -497,155 +542,142 @@ var deleteV1WebhookSubscriptionHeaderParamsSchema = z5.object({
|
|
|
497
542
|
"api-key": z5.string().uuid().describe("Your API key")
|
|
498
543
|
});
|
|
499
544
|
var deleteV1WebhookSubscription200Schema = z5.any();
|
|
500
|
-
var deleteV1WebhookSubscriptionMutationResponseSchema = z5.lazy(() => deleteV1WebhookSubscription200Schema);
|
|
501
545
|
|
|
502
546
|
// src/generated/client/schemas/exerciseTemplateSchema.ts
|
|
503
547
|
import { z as z6 } from "zod";
|
|
504
548
|
var exerciseTemplateSchema = z6.object({
|
|
505
|
-
id: z6.string().describe("The exercise template ID.")
|
|
506
|
-
title: z6.string().describe("The exercise title.")
|
|
507
|
-
type: z6.string().describe("The exercise type.")
|
|
508
|
-
primary_muscle_group: z6.string().describe("The primary muscle group of the exercise.")
|
|
509
|
-
secondary_muscle_groups: z6.array(z6.string()).describe("The secondary muscle groups of the exercise.")
|
|
510
|
-
is_custom: z6.boolean().describe("A boolean indicating whether the exercise is a custom exercise.")
|
|
549
|
+
"id": z6.optional(z6.string().describe("The exercise template ID.")),
|
|
550
|
+
"title": z6.optional(z6.string().describe("The exercise title.")),
|
|
551
|
+
"type": z6.optional(z6.string().describe("The exercise type.")),
|
|
552
|
+
"primary_muscle_group": z6.optional(z6.string().describe("The primary muscle group of the exercise.")),
|
|
553
|
+
"secondary_muscle_groups": z6.optional(z6.array(z6.string()).describe("The secondary muscle groups of the exercise.")),
|
|
554
|
+
"is_custom": z6.optional(z6.boolean().describe("A boolean indicating whether the exercise is a custom exercise."))
|
|
511
555
|
});
|
|
512
556
|
|
|
513
557
|
// src/generated/client/schemas/getV1ExerciseTemplatesExercisetemplateidSchema.ts
|
|
514
558
|
import { z as z7 } from "zod";
|
|
515
559
|
var getV1ExerciseTemplatesExercisetemplateidPathParamsSchema = z7.object({
|
|
516
|
-
exerciseTemplateId: z7.any()
|
|
560
|
+
"exerciseTemplateId": z7.any()
|
|
517
561
|
});
|
|
518
562
|
var getV1ExerciseTemplatesExercisetemplateidHeaderParamsSchema = z7.object({
|
|
519
563
|
"api-key": z7.string().uuid()
|
|
520
564
|
});
|
|
521
|
-
var getV1ExerciseTemplatesExercisetemplateid200Schema = z7.lazy(() => exerciseTemplateSchema);
|
|
522
565
|
var getV1ExerciseTemplatesExercisetemplateid404Schema = z7.any();
|
|
523
|
-
var getV1ExerciseTemplatesExercisetemplateidQueryResponseSchema = z7.lazy(() => getV1ExerciseTemplatesExercisetemplateid200Schema);
|
|
524
566
|
|
|
525
567
|
// src/generated/client/schemas/getV1ExerciseTemplatesSchema.ts
|
|
526
568
|
import { z as z8 } from "zod";
|
|
527
569
|
var getV1ExerciseTemplatesQueryParamsSchema = z8.object({
|
|
528
|
-
page: z8.coerce.number().int().default(1).describe("Page number (Must be 1 or greater)"),
|
|
529
|
-
pageSize: z8.coerce.number().int().default(5).describe("Number of items on the requested page (Max 100)")
|
|
570
|
+
"page": z8.coerce.number().int().default(1).describe("Page number (Must be 1 or greater)"),
|
|
571
|
+
"pageSize": z8.coerce.number().int().default(5).describe("Number of items on the requested page (Max 100)")
|
|
530
572
|
});
|
|
531
573
|
var getV1ExerciseTemplatesHeaderParamsSchema = z8.object({
|
|
532
574
|
"api-key": z8.string().uuid()
|
|
533
575
|
});
|
|
534
576
|
var getV1ExerciseTemplates200Schema = z8.object({
|
|
535
|
-
page: z8.number().int().default(1).describe("Current page number"),
|
|
536
|
-
page_count: z8.number().int().default(5).describe("Total number of pages"),
|
|
537
|
-
exercise_templates: z8.array(z8.lazy(() => exerciseTemplateSchema))
|
|
577
|
+
"page": z8.optional(z8.number().int().default(1).describe("Current page number")),
|
|
578
|
+
"page_count": z8.optional(z8.number().int().default(5).describe("Total number of pages")),
|
|
579
|
+
"exercise_templates": z8.optional(z8.array(z8.lazy(() => exerciseTemplateSchema)))
|
|
538
580
|
});
|
|
539
581
|
var getV1ExerciseTemplates400Schema = z8.any();
|
|
540
|
-
var getV1ExerciseTemplatesQueryResponseSchema = z8.lazy(() => getV1ExerciseTemplates200Schema);
|
|
541
582
|
|
|
542
583
|
// src/generated/client/schemas/routineFolderSchema.ts
|
|
543
584
|
import { z as z9 } from "zod";
|
|
544
585
|
var routineFolderSchema = z9.object({
|
|
545
|
-
id: z9.number().describe("The routine folder ID.")
|
|
546
|
-
index: z9.number().describe("The routine folder index. Describes the order of the folder in the list.")
|
|
547
|
-
title: z9.string().describe("The routine folder title.")
|
|
548
|
-
updated_at: z9.string().describe("ISO 8601 timestamp of when the folder was last updated.")
|
|
549
|
-
created_at: z9.string().describe("ISO 8601 timestamp of when the folder was created.")
|
|
586
|
+
"id": z9.optional(z9.number().describe("The routine folder ID.")),
|
|
587
|
+
"index": z9.optional(z9.number().describe("The routine folder index. Describes the order of the folder in the list.")),
|
|
588
|
+
"title": z9.optional(z9.string().describe("The routine folder title.")),
|
|
589
|
+
"updated_at": z9.optional(z9.string().describe("ISO 8601 timestamp of when the folder was last updated.")),
|
|
590
|
+
"created_at": z9.optional(z9.string().describe("ISO 8601 timestamp of when the folder was created."))
|
|
550
591
|
});
|
|
551
592
|
|
|
552
593
|
// src/generated/client/schemas/getV1RoutineFoldersFolderidSchema.ts
|
|
553
594
|
import { z as z10 } from "zod";
|
|
554
595
|
var getV1RoutineFoldersFolderidPathParamsSchema = z10.object({
|
|
555
|
-
folderId: z10.any()
|
|
596
|
+
"folderId": z10.any()
|
|
556
597
|
});
|
|
557
598
|
var getV1RoutineFoldersFolderidHeaderParamsSchema = z10.object({
|
|
558
599
|
"api-key": z10.string().uuid()
|
|
559
600
|
});
|
|
560
|
-
var getV1RoutineFoldersFolderid200Schema = z10.lazy(() => routineFolderSchema);
|
|
561
601
|
var getV1RoutineFoldersFolderid404Schema = z10.any();
|
|
562
|
-
var getV1RoutineFoldersFolderidQueryResponseSchema = z10.lazy(() => getV1RoutineFoldersFolderid200Schema);
|
|
563
602
|
|
|
564
603
|
// src/generated/client/schemas/getV1RoutineFoldersSchema.ts
|
|
565
604
|
import { z as z11 } from "zod";
|
|
566
605
|
var getV1RoutineFoldersQueryParamsSchema = z11.object({
|
|
567
|
-
page: z11.coerce.number().int().default(1).describe("Page number (Must be 1 or greater)"),
|
|
568
|
-
pageSize: z11.coerce.number().int().default(5).describe("Number of items on the requested page (Max 10)")
|
|
606
|
+
"page": z11.coerce.number().int().default(1).describe("Page number (Must be 1 or greater)"),
|
|
607
|
+
"pageSize": z11.coerce.number().int().default(5).describe("Number of items on the requested page (Max 10)")
|
|
569
608
|
});
|
|
570
609
|
var getV1RoutineFoldersHeaderParamsSchema = z11.object({
|
|
571
610
|
"api-key": z11.string().uuid()
|
|
572
611
|
});
|
|
573
612
|
var getV1RoutineFolders200Schema = z11.object({
|
|
574
|
-
page: z11.number().int().default(1).describe("Current page number"),
|
|
575
|
-
page_count: z11.number().int().default(5).describe("Total number of pages"),
|
|
576
|
-
routine_folders: z11.array(z11.lazy(() => routineFolderSchema))
|
|
613
|
+
"page": z11.optional(z11.number().int().default(1).describe("Current page number")),
|
|
614
|
+
"page_count": z11.optional(z11.number().int().default(5).describe("Total number of pages")),
|
|
615
|
+
"routine_folders": z11.optional(z11.array(z11.lazy(() => routineFolderSchema)))
|
|
577
616
|
});
|
|
578
617
|
var getV1RoutineFolders400Schema = z11.any();
|
|
579
|
-
var getV1RoutineFoldersQueryResponseSchema = z11.lazy(() => getV1RoutineFolders200Schema);
|
|
580
618
|
|
|
581
619
|
// src/generated/client/schemas/routineSchema.ts
|
|
582
620
|
import { z as z12 } from "zod";
|
|
583
621
|
var routineSchema = z12.object({
|
|
584
|
-
id: z12.string().describe("The routine ID.")
|
|
585
|
-
title: z12.string().describe("The routine title.")
|
|
586
|
-
folder_id: z12.number().describe("The routine folder ID.").
|
|
587
|
-
updated_at: z12.string().describe("ISO 8601 timestamp of when the routine was last updated.")
|
|
588
|
-
created_at: z12.string().describe("ISO 8601 timestamp of when the routine was created.")
|
|
589
|
-
exercises: z12.array(
|
|
590
|
-
z12.
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
})
|
|
612
|
-
).optional()
|
|
613
|
-
})
|
|
614
|
-
).optional()
|
|
622
|
+
"id": z12.optional(z12.string().describe("The routine ID.")),
|
|
623
|
+
"title": z12.optional(z12.string().describe("The routine title.")),
|
|
624
|
+
"folder_id": z12.number().describe("The routine folder ID.").nullish(),
|
|
625
|
+
"updated_at": z12.optional(z12.string().describe("ISO 8601 timestamp of when the routine was last updated.")),
|
|
626
|
+
"created_at": z12.optional(z12.string().describe("ISO 8601 timestamp of when the routine was created.")),
|
|
627
|
+
"exercises": z12.optional(z12.array(z12.object({
|
|
628
|
+
"index": z12.optional(z12.number().describe("Index indicating the order of the exercise in the routine.")),
|
|
629
|
+
"title": z12.optional(z12.string().describe("Title of the exercise")),
|
|
630
|
+
"rest_seconds": z12.optional(z12.string().describe("The rest time in seconds between sets of the exercise")),
|
|
631
|
+
"notes": z12.optional(z12.string().describe("Routine notes on the exercise")),
|
|
632
|
+
"exercise_template_id": z12.optional(z12.string().describe("The id of the exercise template. This can be used to fetch the exercise template.")),
|
|
633
|
+
"supersets_id": z12.number().describe("The id of the superset that the exercise belongs to. A value of null indicates the exercise is not part of a superset.").nullish(),
|
|
634
|
+
"sets": z12.optional(z12.array(z12.object({
|
|
635
|
+
"index": z12.optional(z12.number().describe("Index indicating the order of the set in the routine.")),
|
|
636
|
+
"type": z12.optional(z12.string().describe("The type of set. This can be one of 'normal', 'warmup', 'dropset', 'failure'")),
|
|
637
|
+
"weight_kg": z12.number().describe("Weight lifted in kilograms.").nullish(),
|
|
638
|
+
"reps": z12.number().describe("Number of reps logged for the set").nullish(),
|
|
639
|
+
"rep_range": z12.object({
|
|
640
|
+
"start": z12.number().describe("Starting rep count for the range").nullish(),
|
|
641
|
+
"end": z12.number().describe("Ending rep count for the range").nullish()
|
|
642
|
+
}).describe("Range of reps for the set, if applicable").nullish(),
|
|
643
|
+
"distance_meters": z12.number().describe("Number of meters logged for the set").nullish(),
|
|
644
|
+
"duration_seconds": z12.number().describe("Number of seconds logged for the set").nullish(),
|
|
645
|
+
"rpe": z12.number().describe("RPE (Relative perceived exertion) value logged for the set").nullish(),
|
|
646
|
+
"custom_metric": z12.number().describe("Custom metric logged for the set (Currently only used to log floors or steps for stair machine exercises)").nullish()
|
|
647
|
+
})))
|
|
648
|
+
})))
|
|
615
649
|
});
|
|
616
650
|
|
|
617
651
|
// src/generated/client/schemas/getV1RoutinesRoutineidSchema.ts
|
|
618
652
|
import { z as z13 } from "zod";
|
|
619
653
|
var getV1RoutinesRoutineidPathParamsSchema = z13.object({
|
|
620
|
-
routineId: z13.any()
|
|
654
|
+
"routineId": z13.any()
|
|
621
655
|
});
|
|
622
656
|
var getV1RoutinesRoutineidHeaderParamsSchema = z13.object({
|
|
623
657
|
"api-key": z13.string().uuid()
|
|
624
658
|
});
|
|
625
659
|
var getV1RoutinesRoutineid200Schema = z13.object({
|
|
626
|
-
routine: z13.lazy(() => routineSchema)
|
|
660
|
+
"routine": z13.optional(z13.lazy(() => routineSchema))
|
|
627
661
|
});
|
|
628
662
|
var getV1RoutinesRoutineid400Schema = z13.object({
|
|
629
|
-
error: z13.string().describe("Error message")
|
|
663
|
+
"error": z13.optional(z13.string().describe("Error message"))
|
|
630
664
|
});
|
|
631
|
-
var getV1RoutinesRoutineidQueryResponseSchema = z13.lazy(() => getV1RoutinesRoutineid200Schema);
|
|
632
665
|
|
|
633
666
|
// src/generated/client/schemas/getV1RoutinesSchema.ts
|
|
634
667
|
import { z as z14 } from "zod";
|
|
635
668
|
var getV1RoutinesQueryParamsSchema = z14.object({
|
|
636
|
-
page: z14.coerce.number().int().default(1).describe("Page number (Must be 1 or greater)"),
|
|
637
|
-
pageSize: z14.coerce.number().int().default(5).describe("Number of items on the requested page (Max 10)")
|
|
669
|
+
"page": z14.coerce.number().int().default(1).describe("Page number (Must be 1 or greater)"),
|
|
670
|
+
"pageSize": z14.coerce.number().int().default(5).describe("Number of items on the requested page (Max 10)")
|
|
638
671
|
});
|
|
639
672
|
var getV1RoutinesHeaderParamsSchema = z14.object({
|
|
640
673
|
"api-key": z14.string().uuid()
|
|
641
674
|
});
|
|
642
675
|
var getV1Routines200Schema = z14.object({
|
|
643
|
-
page: z14.number().int().describe("Current page number")
|
|
644
|
-
page_count: z14.number().int().describe("Total number of pages")
|
|
645
|
-
routines: z14.array(z14.lazy(() => routineSchema))
|
|
676
|
+
"page": z14.optional(z14.number().int().describe("Current page number")),
|
|
677
|
+
"page_count": z14.optional(z14.number().int().describe("Total number of pages")),
|
|
678
|
+
"routines": z14.optional(z14.array(z14.lazy(() => routineSchema)))
|
|
646
679
|
});
|
|
647
680
|
var getV1Routines400Schema = z14.any();
|
|
648
|
-
var getV1RoutinesQueryResponseSchema = z14.lazy(() => getV1Routines200Schema);
|
|
649
681
|
|
|
650
682
|
// src/generated/client/schemas/getV1WebhookSubscriptionSchema.ts
|
|
651
683
|
import { z as z15 } from "zod";
|
|
@@ -653,11 +685,10 @@ var getV1WebhookSubscriptionHeaderParamsSchema = z15.object({
|
|
|
653
685
|
"api-key": z15.string().uuid().describe("Your API key")
|
|
654
686
|
});
|
|
655
687
|
var getV1WebhookSubscription200Schema = z15.object({
|
|
656
|
-
url: z15.string().describe("The webhook URL")
|
|
657
|
-
auth_token: z15.string().describe("The auth token for the webhook")
|
|
688
|
+
"url": z15.optional(z15.string().describe("The webhook URL")),
|
|
689
|
+
"auth_token": z15.optional(z15.string().describe("The auth token for the webhook"))
|
|
658
690
|
});
|
|
659
691
|
var getV1WebhookSubscription404Schema = z15.any();
|
|
660
|
-
var getV1WebhookSubscriptionQueryResponseSchema = z15.lazy(() => getV1WebhookSubscription200Schema);
|
|
661
692
|
|
|
662
693
|
// src/generated/client/schemas/getV1WorkoutsCountSchema.ts
|
|
663
694
|
import { z as z16 } from "zod";
|
|
@@ -665,143 +696,133 @@ var getV1WorkoutsCountHeaderParamsSchema = z16.object({
|
|
|
665
696
|
"api-key": z16.string().uuid()
|
|
666
697
|
});
|
|
667
698
|
var getV1WorkoutsCount200Schema = z16.object({
|
|
668
|
-
workout_count: z16.number().int().default(42).describe("The total number of workouts")
|
|
699
|
+
"workout_count": z16.optional(z16.number().int().default(42).describe("The total number of workouts"))
|
|
669
700
|
});
|
|
670
|
-
var getV1WorkoutsCountQueryResponseSchema = z16.lazy(() => getV1WorkoutsCount200Schema);
|
|
671
701
|
|
|
672
702
|
// src/generated/client/schemas/workoutSchema.ts
|
|
673
703
|
import { z as z17 } from "zod";
|
|
674
704
|
var workoutSchema = z17.object({
|
|
675
|
-
id: z17.string().describe("The workout ID.")
|
|
676
|
-
title: z17.string().describe("The workout title.")
|
|
677
|
-
description: z17.string().describe("The workout description.")
|
|
678
|
-
start_time: z17.number().describe("ISO 8601 timestamp of when the workout was recorded to have started.")
|
|
679
|
-
end_time: z17.number().describe("ISO 8601 timestamp of when the workout was recorded to have ended.")
|
|
680
|
-
updated_at: z17.string().describe("ISO 8601 timestamp of when the workout was last updated.")
|
|
681
|
-
created_at: z17.string().describe("ISO 8601 timestamp of when the workout was created.")
|
|
682
|
-
exercises: z17.array(
|
|
683
|
-
z17.
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
})
|
|
700
|
-
).optional()
|
|
701
|
-
})
|
|
702
|
-
).optional()
|
|
705
|
+
"id": z17.optional(z17.string().describe("The workout ID.")),
|
|
706
|
+
"title": z17.optional(z17.string().describe("The workout title.")),
|
|
707
|
+
"description": z17.optional(z17.string().describe("The workout description.")),
|
|
708
|
+
"start_time": z17.optional(z17.number().describe("ISO 8601 timestamp of when the workout was recorded to have started.")),
|
|
709
|
+
"end_time": z17.optional(z17.number().describe("ISO 8601 timestamp of when the workout was recorded to have ended.")),
|
|
710
|
+
"updated_at": z17.optional(z17.string().describe("ISO 8601 timestamp of when the workout was last updated.")),
|
|
711
|
+
"created_at": z17.optional(z17.string().describe("ISO 8601 timestamp of when the workout was created.")),
|
|
712
|
+
"exercises": z17.optional(z17.array(z17.object({
|
|
713
|
+
"index": z17.optional(z17.number().describe("Index indicating the order of the exercise in the workout.")),
|
|
714
|
+
"title": z17.optional(z17.string().describe("Title of the exercise")),
|
|
715
|
+
"notes": z17.optional(z17.string().describe("Notes on the exercise")),
|
|
716
|
+
"exercise_template_id": z17.optional(z17.string().describe("The id of the exercise template. This can be used to fetch the exercise template.")),
|
|
717
|
+
"supersets_id": z17.number().describe("The id of the superset that the exercise belongs to. A value of null indicates the exercise is not part of a superset.").nullish(),
|
|
718
|
+
"sets": z17.optional(z17.array(z17.object({
|
|
719
|
+
"index": z17.optional(z17.number().describe("Index indicating the order of the set in the workout.")),
|
|
720
|
+
"type": z17.optional(z17.string().describe("The type of set. This can be one of 'normal', 'warmup', 'dropset', 'failure'")),
|
|
721
|
+
"weight_kg": z17.number().describe("Weight lifted in kilograms.").nullish(),
|
|
722
|
+
"reps": z17.number().describe("Number of reps logged for the set").nullish(),
|
|
723
|
+
"distance_meters": z17.number().describe("Number of meters logged for the set").nullish(),
|
|
724
|
+
"duration_seconds": z17.number().describe("Number of seconds logged for the set").nullish(),
|
|
725
|
+
"rpe": z17.number().describe("RPE (Relative perceived exertion) value logged for the set").nullish(),
|
|
726
|
+
"custom_metric": z17.number().describe("Custom metric logged for the set (Currently only used to log floors or steps for stair machine exercises)").nullish()
|
|
727
|
+
})))
|
|
728
|
+
})))
|
|
703
729
|
});
|
|
704
730
|
|
|
705
731
|
// src/generated/client/schemas/updatedWorkoutSchema.ts
|
|
706
732
|
import { z as z18 } from "zod";
|
|
707
733
|
var updatedWorkoutSchema = z18.object({
|
|
708
|
-
type: z18.string().describe("Indicates the type of the event (updated)"),
|
|
709
|
-
workout: z18.lazy(() => workoutSchema)
|
|
734
|
+
"type": z18.string().describe("Indicates the type of the event (updated)"),
|
|
735
|
+
"workout": z18.lazy(() => workoutSchema)
|
|
710
736
|
});
|
|
711
737
|
|
|
712
738
|
// src/generated/client/schemas/paginatedWorkoutEventsSchema.ts
|
|
713
739
|
import { z as z19 } from "zod";
|
|
714
740
|
var paginatedWorkoutEventsSchema = z19.object({
|
|
715
|
-
page: z19.number().int().describe("The current page number"),
|
|
716
|
-
page_count: z19.number().int().describe("The total number of pages available"),
|
|
717
|
-
events: z19.array(z19.union([z19.lazy(() => updatedWorkoutSchema), z19.lazy(() => deletedWorkoutSchema)])).describe("An array of workout events (either updated or deleted)")
|
|
741
|
+
"page": z19.number().int().describe("The current page number"),
|
|
742
|
+
"page_count": z19.number().int().describe("The total number of pages available"),
|
|
743
|
+
"events": z19.array(z19.union([z19.lazy(() => updatedWorkoutSchema), z19.lazy(() => deletedWorkoutSchema)])).describe("An array of workout events (either updated or deleted)")
|
|
718
744
|
});
|
|
719
745
|
|
|
720
746
|
// src/generated/client/schemas/getV1WorkoutsEventsSchema.ts
|
|
721
747
|
import { z as z20 } from "zod";
|
|
722
748
|
var getV1WorkoutsEventsQueryParamsSchema = z20.object({
|
|
723
|
-
page: z20.coerce.number().int().default(1).describe("Page number (Must be 1 or greater)"),
|
|
724
|
-
pageSize: z20.coerce.number().int().default(5).describe("Number of items on the requested page (Max 10)"),
|
|
725
|
-
since: z20.string().default("1970-01-01T00:00:00Z")
|
|
749
|
+
"page": z20.coerce.number().int().default(1).describe("Page number (Must be 1 or greater)"),
|
|
750
|
+
"pageSize": z20.coerce.number().int().default(5).describe("Number of items on the requested page (Max 10)"),
|
|
751
|
+
"since": z20.string().default("1970-01-01T00:00:00Z")
|
|
726
752
|
});
|
|
727
753
|
var getV1WorkoutsEventsHeaderParamsSchema = z20.object({
|
|
728
754
|
"api-key": z20.string().uuid()
|
|
729
755
|
});
|
|
730
|
-
var getV1WorkoutsEvents200Schema = z20.lazy(() => paginatedWorkoutEventsSchema);
|
|
731
756
|
var getV1WorkoutsEvents500Schema = z20.any();
|
|
732
|
-
var getV1WorkoutsEventsQueryResponseSchema = z20.lazy(() => getV1WorkoutsEvents200Schema);
|
|
733
757
|
|
|
734
758
|
// src/generated/client/schemas/getV1WorkoutsSchema.ts
|
|
735
759
|
import { z as z21 } from "zod";
|
|
736
760
|
var getV1WorkoutsQueryParamsSchema = z21.object({
|
|
737
|
-
page: z21.coerce.number().int().default(1).describe("Page number (Must be 1 or greater)"),
|
|
738
|
-
pageSize: z21.coerce.number().int().default(5).describe("Number of items on the requested page (Max 10)")
|
|
761
|
+
"page": z21.coerce.number().int().default(1).describe("Page number (Must be 1 or greater)"),
|
|
762
|
+
"pageSize": z21.coerce.number().int().default(5).describe("Number of items on the requested page (Max 10)")
|
|
739
763
|
});
|
|
740
764
|
var getV1WorkoutsHeaderParamsSchema = z21.object({
|
|
741
765
|
"api-key": z21.string().uuid()
|
|
742
766
|
});
|
|
743
767
|
var getV1Workouts200Schema = z21.object({
|
|
744
|
-
page: z21.number().int().describe("Current page number")
|
|
745
|
-
page_count: z21.number().int().describe("Total number of pages")
|
|
746
|
-
workouts: z21.array(z21.lazy(() => workoutSchema))
|
|
768
|
+
"page": z21.optional(z21.number().int().describe("Current page number")),
|
|
769
|
+
"page_count": z21.optional(z21.number().int().describe("Total number of pages")),
|
|
770
|
+
"workouts": z21.optional(z21.array(z21.lazy(() => workoutSchema)))
|
|
747
771
|
});
|
|
748
772
|
var getV1Workouts400Schema = z21.any();
|
|
749
|
-
var getV1WorkoutsQueryResponseSchema = z21.lazy(() => getV1Workouts200Schema);
|
|
750
773
|
|
|
751
774
|
// src/generated/client/schemas/getV1WorkoutsWorkoutidSchema.ts
|
|
752
775
|
import { z as z22 } from "zod";
|
|
753
776
|
var getV1WorkoutsWorkoutidPathParamsSchema = z22.object({
|
|
754
|
-
workoutId: z22.any()
|
|
777
|
+
"workoutId": z22.any()
|
|
755
778
|
});
|
|
756
779
|
var getV1WorkoutsWorkoutidHeaderParamsSchema = z22.object({
|
|
757
780
|
"api-key": z22.string().uuid()
|
|
758
781
|
});
|
|
759
|
-
var getV1WorkoutsWorkoutid200Schema = z22.lazy(() => workoutSchema);
|
|
760
782
|
var getV1WorkoutsWorkoutid404Schema = z22.any();
|
|
761
|
-
var getV1WorkoutsWorkoutidQueryResponseSchema = z22.lazy(() => getV1WorkoutsWorkoutid200Schema);
|
|
762
783
|
|
|
763
784
|
// src/generated/client/schemas/postRoutineFolderRequestBodySchema.ts
|
|
764
785
|
import { z as z23 } from "zod";
|
|
765
786
|
var postRoutineFolderRequestBodySchema = z23.object({
|
|
766
|
-
routine_folder: z23.object({
|
|
767
|
-
title: z23.string().describe("The title of the routine folder.")
|
|
768
|
-
})
|
|
787
|
+
"routine_folder": z23.optional(z23.object({
|
|
788
|
+
"title": z23.optional(z23.string().describe("The title of the routine folder."))
|
|
789
|
+
}))
|
|
769
790
|
});
|
|
770
791
|
|
|
771
792
|
// src/generated/client/schemas/postRoutinesRequestSetSchema.ts
|
|
772
793
|
import { z as z24 } from "zod";
|
|
773
794
|
var postRoutinesRequestSetSchema = z24.object({
|
|
774
|
-
type: z24.enum(["warmup", "normal", "failure", "dropset"]).describe("The type of the set.")
|
|
775
|
-
weight_kg: z24.number().describe("The weight in kilograms.").
|
|
776
|
-
reps: z24.number().int().describe("The number of repetitions.").
|
|
777
|
-
distance_meters: z24.number().int().describe("The distance in meters.").
|
|
778
|
-
duration_seconds: z24.number().int().describe("The duration in seconds.").
|
|
779
|
-
custom_metric: z24.number().describe("A custom metric for the set. Currently used for steps and floors.").
|
|
780
|
-
rep_range: z24.object({
|
|
781
|
-
start: z24.number().describe("Starting rep count for the range").
|
|
782
|
-
end: z24.number().describe("Ending rep count for the range").
|
|
783
|
-
}).describe("Range of reps for the set, if applicable").
|
|
795
|
+
"type": z24.optional(z24.enum(["warmup", "normal", "failure", "dropset"]).describe("The type of the set.")),
|
|
796
|
+
"weight_kg": z24.number().describe("The weight in kilograms.").nullish(),
|
|
797
|
+
"reps": z24.number().int().describe("The number of repetitions.").nullish(),
|
|
798
|
+
"distance_meters": z24.number().int().describe("The distance in meters.").nullish(),
|
|
799
|
+
"duration_seconds": z24.number().int().describe("The duration in seconds.").nullish(),
|
|
800
|
+
"custom_metric": z24.number().describe("A custom metric for the set. Currently used for steps and floors.").nullish(),
|
|
801
|
+
"rep_range": z24.object({
|
|
802
|
+
"start": z24.number().describe("Starting rep count for the range").nullish(),
|
|
803
|
+
"end": z24.number().describe("Ending rep count for the range").nullish()
|
|
804
|
+
}).describe("Range of reps for the set, if applicable").nullish()
|
|
784
805
|
});
|
|
785
806
|
|
|
786
807
|
// src/generated/client/schemas/postRoutinesRequestExerciseSchema.ts
|
|
787
808
|
import { z as z25 } from "zod";
|
|
788
809
|
var postRoutinesRequestExerciseSchema = z25.object({
|
|
789
|
-
exercise_template_id: z25.string().describe("The ID of the exercise template.")
|
|
790
|
-
superset_id: z25.number().int().describe("The ID of the superset.").
|
|
791
|
-
rest_seconds: z25.number().int().describe("The rest time in seconds.").
|
|
792
|
-
notes: z25.string().describe("Additional notes for the exercise.").
|
|
793
|
-
sets: z25.array(z25.lazy(() => postRoutinesRequestSetSchema))
|
|
810
|
+
"exercise_template_id": z25.optional(z25.string().describe("The ID of the exercise template.")),
|
|
811
|
+
"superset_id": z25.number().int().describe("The ID of the superset.").nullish(),
|
|
812
|
+
"rest_seconds": z25.number().int().describe("The rest time in seconds.").nullish(),
|
|
813
|
+
"notes": z25.string().describe("Additional notes for the exercise.").nullish(),
|
|
814
|
+
"sets": z25.optional(z25.array(z25.lazy(() => postRoutinesRequestSetSchema)))
|
|
794
815
|
});
|
|
795
816
|
|
|
796
817
|
// src/generated/client/schemas/postRoutinesRequestBodySchema.ts
|
|
797
818
|
import { z as z26 } from "zod";
|
|
798
819
|
var postRoutinesRequestBodySchema = z26.object({
|
|
799
|
-
routine: z26.object({
|
|
800
|
-
title: z26.string().describe("The title of the routine.")
|
|
801
|
-
folder_id: z26.number().describe('The folder id the routine should be added to. Pass null to insert the routine into default "My Routines" folder').
|
|
802
|
-
notes: z26.string().describe("Additional notes for the routine.")
|
|
803
|
-
exercises: z26.array(z26.lazy(() => postRoutinesRequestExerciseSchema))
|
|
804
|
-
})
|
|
820
|
+
"routine": z26.optional(z26.object({
|
|
821
|
+
"title": z26.optional(z26.string().describe("The title of the routine.")),
|
|
822
|
+
"folder_id": z26.number().describe('The folder id the routine should be added to. Pass null to insert the routine into default "My Routines" folder').nullish(),
|
|
823
|
+
"notes": z26.optional(z26.string().describe("Additional notes for the routine.")),
|
|
824
|
+
"exercises": z26.optional(z26.array(z26.lazy(() => postRoutinesRequestExerciseSchema)))
|
|
825
|
+
}))
|
|
805
826
|
});
|
|
806
827
|
|
|
807
828
|
// src/generated/client/schemas/postV1RoutineFoldersSchema.ts
|
|
@@ -809,33 +830,27 @@ import { z as z27 } from "zod";
|
|
|
809
830
|
var postV1RoutineFoldersHeaderParamsSchema = z27.object({
|
|
810
831
|
"api-key": z27.string().uuid()
|
|
811
832
|
});
|
|
812
|
-
var postV1RoutineFolders201Schema = z27.lazy(() => routineFolderSchema);
|
|
813
833
|
var postV1RoutineFolders400Schema = z27.object({
|
|
814
|
-
error: z27.string().describe("Error message")
|
|
834
|
+
"error": z27.optional(z27.string().describe("Error message"))
|
|
815
835
|
});
|
|
816
|
-
var postV1RoutineFoldersMutationRequestSchema = z27.lazy(() => postRoutineFolderRequestBodySchema);
|
|
817
|
-
var postV1RoutineFoldersMutationResponseSchema = z27.lazy(() => postV1RoutineFolders201Schema);
|
|
818
836
|
|
|
819
837
|
// src/generated/client/schemas/postV1RoutinesSchema.ts
|
|
820
838
|
import { z as z28 } from "zod";
|
|
821
839
|
var postV1RoutinesHeaderParamsSchema = z28.object({
|
|
822
840
|
"api-key": z28.string().uuid()
|
|
823
841
|
});
|
|
824
|
-
var postV1Routines201Schema = z28.lazy(() => routineSchema);
|
|
825
842
|
var postV1Routines400Schema = z28.object({
|
|
826
|
-
error: z28.string().describe("Error message")
|
|
843
|
+
"error": z28.optional(z28.string().describe("Error message"))
|
|
827
844
|
});
|
|
828
845
|
var postV1Routines403Schema = z28.object({
|
|
829
|
-
error: z28.string().describe("Error message")
|
|
846
|
+
"error": z28.optional(z28.string().describe("Error message"))
|
|
830
847
|
});
|
|
831
|
-
var postV1RoutinesMutationRequestSchema = z28.lazy(() => postRoutinesRequestBodySchema);
|
|
832
|
-
var postV1RoutinesMutationResponseSchema = z28.lazy(() => postV1Routines201Schema);
|
|
833
848
|
|
|
834
849
|
// src/generated/client/schemas/webhookRequestBodySchema.ts
|
|
835
850
|
import { z as z29 } from "zod";
|
|
836
851
|
var webhookRequestBodySchema = z29.object({
|
|
837
|
-
authToken: z29.string().describe("The auth token that will be send as Authorization header in the webhook.")
|
|
838
|
-
url: z29.string().describe("The webhook URL.")
|
|
852
|
+
"authToken": z29.optional(z29.string().describe("The auth token that will be send as Authorization header in the webhook.")),
|
|
853
|
+
"url": z29.optional(z29.string().describe("The webhook URL."))
|
|
839
854
|
});
|
|
840
855
|
|
|
841
856
|
// src/generated/client/schemas/postV1WebhookSubscriptionSchema.ts
|
|
@@ -845,43 +860,41 @@ var postV1WebhookSubscriptionHeaderParamsSchema = z30.object({
|
|
|
845
860
|
});
|
|
846
861
|
var postV1WebhookSubscription201Schema = z30.any();
|
|
847
862
|
var postV1WebhookSubscription400Schema = z30.object({
|
|
848
|
-
error: z30.string().describe("Error message")
|
|
863
|
+
"error": z30.optional(z30.string().describe("Error message"))
|
|
849
864
|
});
|
|
850
|
-
var postV1WebhookSubscriptionMutationRequestSchema = z30.lazy(() => webhookRequestBodySchema);
|
|
851
|
-
var postV1WebhookSubscriptionMutationResponseSchema = z30.lazy(() => postV1WebhookSubscription201Schema);
|
|
852
865
|
|
|
853
866
|
// src/generated/client/schemas/postWorkoutsRequestSetSchema.ts
|
|
854
867
|
import { z as z31 } from "zod";
|
|
855
868
|
var postWorkoutsRequestSetSchema = z31.object({
|
|
856
|
-
type: z31.enum(["warmup", "normal", "failure", "dropset"]).describe("The type of the set.")
|
|
857
|
-
weight_kg: z31.number().describe("The weight in kilograms.").
|
|
858
|
-
reps: z31.number().int().describe("The number of repetitions.").
|
|
859
|
-
distance_meters: z31.number().int().describe("The distance in meters.").
|
|
860
|
-
duration_seconds: z31.number().int().describe("The duration in seconds.").
|
|
861
|
-
custom_metric: z31.number().describe("A custom metric for the set. Currently used for steps and floors.").
|
|
862
|
-
rpe: z31.union([z31.literal(6), z31.literal(7), z31.literal(7.5), z31.literal(8), z31.literal(8.5), z31.literal(9), z31.literal(9.5), z31.literal(10)]).describe("The Rating of Perceived Exertion (RPE).").
|
|
869
|
+
"type": z31.optional(z31.enum(["warmup", "normal", "failure", "dropset"]).describe("The type of the set.")),
|
|
870
|
+
"weight_kg": z31.number().describe("The weight in kilograms.").nullish(),
|
|
871
|
+
"reps": z31.number().int().describe("The number of repetitions.").nullish(),
|
|
872
|
+
"distance_meters": z31.number().int().describe("The distance in meters.").nullish(),
|
|
873
|
+
"duration_seconds": z31.number().int().describe("The duration in seconds.").nullish(),
|
|
874
|
+
"custom_metric": z31.number().describe("A custom metric for the set. Currently used for steps and floors.").nullish(),
|
|
875
|
+
"rpe": z31.union([z31.literal(6), z31.literal(7), z31.literal(7.5), z31.literal(8), z31.literal(8.5), z31.literal(9), z31.literal(9.5), z31.literal(10)]).describe("The Rating of Perceived Exertion (RPE).").nullish()
|
|
863
876
|
});
|
|
864
877
|
|
|
865
878
|
// src/generated/client/schemas/postWorkoutsRequestExerciseSchema.ts
|
|
866
879
|
import { z as z32 } from "zod";
|
|
867
880
|
var postWorkoutsRequestExerciseSchema = z32.object({
|
|
868
|
-
exercise_template_id: z32.string().describe("The ID of the exercise template.")
|
|
869
|
-
superset_id: z32.number().int().describe("The ID of the superset.").
|
|
870
|
-
notes: z32.string().describe("Additional notes for the exercise.").
|
|
871
|
-
sets: z32.array(z32.lazy(() => postWorkoutsRequestSetSchema))
|
|
881
|
+
"exercise_template_id": z32.optional(z32.string().describe("The ID of the exercise template.")),
|
|
882
|
+
"superset_id": z32.number().int().describe("The ID of the superset.").nullish(),
|
|
883
|
+
"notes": z32.string().describe("Additional notes for the exercise.").nullish(),
|
|
884
|
+
"sets": z32.optional(z32.array(z32.lazy(() => postWorkoutsRequestSetSchema)))
|
|
872
885
|
});
|
|
873
886
|
|
|
874
887
|
// src/generated/client/schemas/postWorkoutsRequestBodySchema.ts
|
|
875
888
|
import { z as z33 } from "zod";
|
|
876
889
|
var postWorkoutsRequestBodySchema = z33.object({
|
|
877
|
-
workout: z33.object({
|
|
878
|
-
title: z33.string().describe("The title of the workout.")
|
|
879
|
-
description: z33.string().describe("A description for the workout workout.").
|
|
880
|
-
start_time: z33.string().describe("The time the workout started.")
|
|
881
|
-
end_time: z33.string().describe("The time the workout ended.")
|
|
882
|
-
is_private: z33.boolean().describe("A boolean indicating if the workout is private.")
|
|
883
|
-
exercises: z33.array(z33.lazy(() => postWorkoutsRequestExerciseSchema))
|
|
884
|
-
})
|
|
890
|
+
"workout": z33.optional(z33.object({
|
|
891
|
+
"title": z33.optional(z33.string().describe("The title of the workout.")),
|
|
892
|
+
"description": z33.string().describe("A description for the workout workout.").nullish(),
|
|
893
|
+
"start_time": z33.optional(z33.string().describe("The time the workout started.")),
|
|
894
|
+
"end_time": z33.optional(z33.string().describe("The time the workout ended.")),
|
|
895
|
+
"is_private": z33.optional(z33.boolean().describe("A boolean indicating if the workout is private.")),
|
|
896
|
+
"exercises": z33.optional(z33.array(z33.lazy(() => postWorkoutsRequestExerciseSchema)))
|
|
897
|
+
}))
|
|
885
898
|
});
|
|
886
899
|
|
|
887
900
|
// src/generated/client/schemas/postV1WorkoutsSchema.ts
|
|
@@ -889,80 +902,71 @@ import { z as z34 } from "zod";
|
|
|
889
902
|
var postV1WorkoutsHeaderParamsSchema = z34.object({
|
|
890
903
|
"api-key": z34.string().uuid()
|
|
891
904
|
});
|
|
892
|
-
var postV1Workouts201Schema = z34.lazy(() => workoutSchema);
|
|
893
905
|
var postV1Workouts400Schema = z34.object({
|
|
894
|
-
error: z34.string().describe("Error message")
|
|
906
|
+
"error": z34.optional(z34.string().describe("Error message"))
|
|
895
907
|
});
|
|
896
|
-
var postV1WorkoutsMutationRequestSchema = z34.lazy(() => postWorkoutsRequestBodySchema);
|
|
897
|
-
var postV1WorkoutsMutationResponseSchema = z34.lazy(() => postV1Workouts201Schema);
|
|
898
908
|
|
|
899
909
|
// src/generated/client/schemas/putRoutinesRequestSetSchema.ts
|
|
900
910
|
import { z as z35 } from "zod";
|
|
901
911
|
var putRoutinesRequestSetSchema = z35.object({
|
|
902
|
-
type: z35.enum(["warmup", "normal", "failure", "dropset"]).describe("The type of the set.")
|
|
903
|
-
weight_kg: z35.number().describe("The weight in kilograms.").
|
|
904
|
-
reps: z35.number().int().describe("The number of repetitions.").
|
|
905
|
-
distance_meters: z35.number().int().describe("The distance in meters.").
|
|
906
|
-
duration_seconds: z35.number().int().describe("The duration in seconds.").
|
|
907
|
-
custom_metric: z35.number().describe("A custom metric for the set. Currently used for steps and floors.").
|
|
908
|
-
rep_range: z35.object({
|
|
909
|
-
start: z35.number().describe("Starting rep count for the range").
|
|
910
|
-
end: z35.number().describe("Ending rep count for the range").
|
|
911
|
-
}).describe("Range of reps for the set, if applicable").
|
|
912
|
+
"type": z35.optional(z35.enum(["warmup", "normal", "failure", "dropset"]).describe("The type of the set.")),
|
|
913
|
+
"weight_kg": z35.number().describe("The weight in kilograms.").nullish(),
|
|
914
|
+
"reps": z35.number().int().describe("The number of repetitions.").nullish(),
|
|
915
|
+
"distance_meters": z35.number().int().describe("The distance in meters.").nullish(),
|
|
916
|
+
"duration_seconds": z35.number().int().describe("The duration in seconds.").nullish(),
|
|
917
|
+
"custom_metric": z35.number().describe("A custom metric for the set. Currently used for steps and floors.").nullish(),
|
|
918
|
+
"rep_range": z35.object({
|
|
919
|
+
"start": z35.number().describe("Starting rep count for the range").nullish(),
|
|
920
|
+
"end": z35.number().describe("Ending rep count for the range").nullish()
|
|
921
|
+
}).describe("Range of reps for the set, if applicable").nullish()
|
|
912
922
|
});
|
|
913
923
|
|
|
914
924
|
// src/generated/client/schemas/putRoutinesRequestExerciseSchema.ts
|
|
915
925
|
import { z as z36 } from "zod";
|
|
916
926
|
var putRoutinesRequestExerciseSchema = z36.object({
|
|
917
|
-
exercise_template_id: z36.string().describe("The ID of the exercise template.")
|
|
918
|
-
superset_id: z36.number().int().describe("The ID of the superset.").
|
|
919
|
-
rest_seconds: z36.number().int().describe("The rest time in seconds.").
|
|
920
|
-
notes: z36.string().describe("Additional notes for the exercise.").
|
|
921
|
-
sets: z36.array(z36.lazy(() => putRoutinesRequestSetSchema))
|
|
927
|
+
"exercise_template_id": z36.optional(z36.string().describe("The ID of the exercise template.")),
|
|
928
|
+
"superset_id": z36.number().int().describe("The ID of the superset.").nullish(),
|
|
929
|
+
"rest_seconds": z36.number().int().describe("The rest time in seconds.").nullish(),
|
|
930
|
+
"notes": z36.string().describe("Additional notes for the exercise.").nullish(),
|
|
931
|
+
"sets": z36.optional(z36.array(z36.lazy(() => putRoutinesRequestSetSchema)))
|
|
922
932
|
});
|
|
923
933
|
|
|
924
934
|
// src/generated/client/schemas/putRoutinesRequestBodySchema.ts
|
|
925
935
|
import { z as z37 } from "zod";
|
|
926
936
|
var putRoutinesRequestBodySchema = z37.object({
|
|
927
|
-
routine: z37.object({
|
|
928
|
-
title: z37.string().describe("The title of the routine.")
|
|
929
|
-
notes: z37.string().describe("Additional notes for the routine.").
|
|
930
|
-
exercises: z37.array(z37.lazy(() => putRoutinesRequestExerciseSchema))
|
|
931
|
-
})
|
|
937
|
+
"routine": z37.optional(z37.object({
|
|
938
|
+
"title": z37.optional(z37.string().describe("The title of the routine.")),
|
|
939
|
+
"notes": z37.string().describe("Additional notes for the routine.").nullish(),
|
|
940
|
+
"exercises": z37.optional(z37.array(z37.lazy(() => putRoutinesRequestExerciseSchema)))
|
|
941
|
+
}))
|
|
932
942
|
});
|
|
933
943
|
|
|
934
944
|
// src/generated/client/schemas/putV1RoutinesRoutineidSchema.ts
|
|
935
945
|
import { z as z38 } from "zod";
|
|
936
946
|
var putV1RoutinesRoutineidPathParamsSchema = z38.object({
|
|
937
|
-
routineId: z38.any()
|
|
947
|
+
"routineId": z38.any()
|
|
938
948
|
});
|
|
939
949
|
var putV1RoutinesRoutineidHeaderParamsSchema = z38.object({
|
|
940
950
|
"api-key": z38.string().uuid()
|
|
941
951
|
});
|
|
942
|
-
var putV1RoutinesRoutineid200Schema = z38.lazy(() => routineSchema);
|
|
943
952
|
var putV1RoutinesRoutineid400Schema = z38.object({
|
|
944
|
-
error: z38.string().describe("Error message")
|
|
953
|
+
"error": z38.optional(z38.string().describe("Error message"))
|
|
945
954
|
});
|
|
946
955
|
var putV1RoutinesRoutineid404Schema = z38.object({
|
|
947
|
-
error: z38.string().describe("Error message")
|
|
956
|
+
"error": z38.optional(z38.string().describe("Error message"))
|
|
948
957
|
});
|
|
949
|
-
var putV1RoutinesRoutineidMutationRequestSchema = z38.lazy(() => putRoutinesRequestBodySchema);
|
|
950
|
-
var putV1RoutinesRoutineidMutationResponseSchema = z38.lazy(() => putV1RoutinesRoutineid200Schema);
|
|
951
958
|
|
|
952
959
|
// src/generated/client/schemas/putV1WorkoutsWorkoutidSchema.ts
|
|
953
960
|
import { z as z39 } from "zod";
|
|
954
961
|
var putV1WorkoutsWorkoutidPathParamsSchema = z39.object({
|
|
955
|
-
workoutId: z39.any()
|
|
962
|
+
"workoutId": z39.any()
|
|
956
963
|
});
|
|
957
964
|
var putV1WorkoutsWorkoutidHeaderParamsSchema = z39.object({
|
|
958
965
|
"api-key": z39.string().uuid()
|
|
959
966
|
});
|
|
960
|
-
var putV1WorkoutsWorkoutid200Schema = z39.lazy(() => workoutSchema);
|
|
961
967
|
var putV1WorkoutsWorkoutid400Schema = z39.object({
|
|
962
|
-
error: z39.string().describe("Error message")
|
|
968
|
+
"error": z39.optional(z39.string().describe("Error message"))
|
|
963
969
|
});
|
|
964
|
-
var putV1WorkoutsWorkoutidMutationRequestSchema = z39.lazy(() => postWorkoutsRequestBodySchema);
|
|
965
|
-
var putV1WorkoutsWorkoutidMutationResponseSchema = z39.lazy(() => putV1WorkoutsWorkoutid200Schema);
|
|
966
970
|
|
|
967
971
|
// src/tools/webhooks.ts
|
|
968
972
|
var webhookUrlSchema = z40.string().url().refine(
|
|
@@ -996,6 +1000,11 @@ function registerWebhookTools(server2, hevyClient2) {
|
|
|
996
1000
|
"Get the current webhook subscription for this account. Returns the webhook URL and auth token if a subscription exists.",
|
|
997
1001
|
{},
|
|
998
1002
|
withErrorHandling(async () => {
|
|
1003
|
+
if (!hevyClient2) {
|
|
1004
|
+
throw new Error(
|
|
1005
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
999
1008
|
const data = await hevyClient2.getWebhookSubscription();
|
|
1000
1009
|
if (!data) {
|
|
1001
1010
|
return createEmptyResponse(
|
|
@@ -1017,6 +1026,11 @@ function registerWebhookTools(server2, hevyClient2) {
|
|
|
1017
1026
|
)
|
|
1018
1027
|
},
|
|
1019
1028
|
withErrorHandling(async ({ url, authToken }) => {
|
|
1029
|
+
if (!hevyClient2) {
|
|
1030
|
+
throw new Error(
|
|
1031
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
1032
|
+
);
|
|
1033
|
+
}
|
|
1020
1034
|
const requestBody = webhookRequestBodySchema.parse({
|
|
1021
1035
|
url,
|
|
1022
1036
|
authToken
|
|
@@ -1035,6 +1049,11 @@ function registerWebhookTools(server2, hevyClient2) {
|
|
|
1035
1049
|
"Delete the current webhook subscription for this account. This will stop all webhook notifications.",
|
|
1036
1050
|
{},
|
|
1037
1051
|
withErrorHandling(async () => {
|
|
1052
|
+
if (!hevyClient2) {
|
|
1053
|
+
throw new Error(
|
|
1054
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1038
1057
|
const data = await hevyClient2.deleteWebhookSubscription();
|
|
1039
1058
|
if (!data) {
|
|
1040
1059
|
return createEmptyResponse(
|
|
@@ -1057,6 +1076,11 @@ function registerWorkoutTools(server2, hevyClient2) {
|
|
|
1057
1076
|
pageSize: z41.coerce.number().int().gte(1).lte(10).default(5)
|
|
1058
1077
|
},
|
|
1059
1078
|
withErrorHandling(async ({ page, pageSize }) => {
|
|
1079
|
+
if (!hevyClient2) {
|
|
1080
|
+
throw new Error(
|
|
1081
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1060
1084
|
const data = await hevyClient2.getWorkouts({
|
|
1061
1085
|
page,
|
|
1062
1086
|
pageSize
|
|
@@ -1077,6 +1101,11 @@ function registerWorkoutTools(server2, hevyClient2) {
|
|
|
1077
1101
|
workoutId: z41.string().min(1)
|
|
1078
1102
|
},
|
|
1079
1103
|
withErrorHandling(async ({ workoutId }) => {
|
|
1104
|
+
if (!hevyClient2) {
|
|
1105
|
+
throw new Error(
|
|
1106
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1080
1109
|
const data = await hevyClient2.getWorkout(workoutId);
|
|
1081
1110
|
if (!data) {
|
|
1082
1111
|
return createEmptyResponse(`Workout with ID ${workoutId} not found`);
|
|
@@ -1090,6 +1119,11 @@ function registerWorkoutTools(server2, hevyClient2) {
|
|
|
1090
1119
|
"Get the total number of workouts on the account. Useful for pagination or statistics.",
|
|
1091
1120
|
{},
|
|
1092
1121
|
withErrorHandling(async () => {
|
|
1122
|
+
if (!hevyClient2) {
|
|
1123
|
+
throw new Error(
|
|
1124
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
1125
|
+
);
|
|
1126
|
+
}
|
|
1093
1127
|
const data = await hevyClient2.getWorkoutCount();
|
|
1094
1128
|
const count = data ? data.workoutCount || 0 : 0;
|
|
1095
1129
|
return createJsonResponse({ count });
|
|
@@ -1104,6 +1138,11 @@ function registerWorkoutTools(server2, hevyClient2) {
|
|
|
1104
1138
|
since: z41.string().default("1970-01-01T00:00:00Z")
|
|
1105
1139
|
},
|
|
1106
1140
|
withErrorHandling(async ({ page, pageSize, since }) => {
|
|
1141
|
+
if (!hevyClient2) {
|
|
1142
|
+
throw new Error(
|
|
1143
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
1144
|
+
);
|
|
1145
|
+
}
|
|
1107
1146
|
const data = await hevyClient2.getWorkoutEvents({
|
|
1108
1147
|
page,
|
|
1109
1148
|
pageSize,
|
|
@@ -1155,6 +1194,11 @@ function registerWorkoutTools(server2, hevyClient2) {
|
|
|
1155
1194
|
isPrivate,
|
|
1156
1195
|
exercises
|
|
1157
1196
|
}) => {
|
|
1197
|
+
if (!hevyClient2) {
|
|
1198
|
+
throw new Error(
|
|
1199
|
+
"API client not initialized. Please provide HEVY_API_KEY."
|
|
1200
|
+
);
|
|
1201
|
+
}
|
|
1158
1202
|
const requestBody = {
|
|
1159
1203
|
workout: {
|
|
1160
1204
|
title,
|
|
@@ -1274,7 +1318,7 @@ function registerWorkoutTools(server2, hevyClient2) {
|
|
|
1274
1318
|
|
|
1275
1319
|
// src/utils/config.ts
|
|
1276
1320
|
function parseConfig(argv, env) {
|
|
1277
|
-
let
|
|
1321
|
+
let apiKey = "";
|
|
1278
1322
|
const apiKeyArgPatterns = [
|
|
1279
1323
|
/^--hevy-api-key=(.+)$/i,
|
|
1280
1324
|
/^--hevyApiKey=(.+)$/i,
|
|
@@ -1284,14 +1328,14 @@ function parseConfig(argv, env) {
|
|
|
1284
1328
|
for (const pattern of apiKeyArgPatterns) {
|
|
1285
1329
|
const m = raw.match(pattern);
|
|
1286
1330
|
if (m) {
|
|
1287
|
-
|
|
1331
|
+
apiKey = m[1];
|
|
1288
1332
|
break;
|
|
1289
1333
|
}
|
|
1290
1334
|
}
|
|
1291
|
-
if (
|
|
1335
|
+
if (apiKey) break;
|
|
1292
1336
|
}
|
|
1293
|
-
if (!
|
|
1294
|
-
|
|
1337
|
+
if (!apiKey) {
|
|
1338
|
+
apiKey = env.HEVY_API_KEY || "";
|
|
1295
1339
|
}
|
|
1296
1340
|
const transportMode = argv.includes("--http") || env.MCP_TRANSPORT === "http" ? "http" : "stdio";
|
|
1297
1341
|
const httpPort = Number.parseInt(env.MCP_HTTP_PORT || "3000", 10);
|
|
@@ -1299,7 +1343,7 @@ function parseConfig(argv, env) {
|
|
|
1299
1343
|
const enableDnsRebindingProtection = env.MCP_DNS_REBINDING_PROTECTION === "true";
|
|
1300
1344
|
const allowedHosts = env.MCP_ALLOWED_HOSTS?.split(",").map((h) => h.trim()).filter(Boolean) || ["127.0.0.1"];
|
|
1301
1345
|
return {
|
|
1302
|
-
apiKey
|
|
1346
|
+
apiKey,
|
|
1303
1347
|
transportMode,
|
|
1304
1348
|
httpHost,
|
|
1305
1349
|
httpPort,
|
|
@@ -1307,10 +1351,10 @@ function parseConfig(argv, env) {
|
|
|
1307
1351
|
allowedHosts
|
|
1308
1352
|
};
|
|
1309
1353
|
}
|
|
1310
|
-
function assertApiKey(
|
|
1311
|
-
if (!
|
|
1354
|
+
function assertApiKey(apiKey) {
|
|
1355
|
+
if (!apiKey) {
|
|
1312
1356
|
console.error(
|
|
1313
|
-
"Hevy API key is required. Provide via HEVY_API_KEY env variable
|
|
1357
|
+
"Hevy API key is required. Provide via HEVY_API_KEY env variable, --hevy-api-key=YOUR_KEY command argument, or ?HEVY_API_KEY=YOUR_KEY query parameter."
|
|
1314
1358
|
);
|
|
1315
1359
|
process.exit(1);
|
|
1316
1360
|
}
|
|
@@ -1322,318 +1366,235 @@ import axios from "axios";
|
|
|
1322
1366
|
// src/generated/client/api/deleteV1WebhookSubscription.ts
|
|
1323
1367
|
import fetch from "@kubb/plugin-client/clients/axios";
|
|
1324
1368
|
function getDeleteV1WebhookSubscriptionUrl() {
|
|
1325
|
-
|
|
1369
|
+
const res = { method: "DELETE", url: `/v1/webhook-subscription` };
|
|
1370
|
+
return res;
|
|
1326
1371
|
}
|
|
1327
1372
|
async function deleteV1WebhookSubscription(headers, config = {}) {
|
|
1328
1373
|
const { client: request = fetch, ...requestConfig } = config;
|
|
1329
|
-
const res = await request({
|
|
1330
|
-
method: "DELETE",
|
|
1331
|
-
url: getDeleteV1WebhookSubscriptionUrl().toString(),
|
|
1332
|
-
...requestConfig,
|
|
1333
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1334
|
-
});
|
|
1374
|
+
const res = await request({ method: "DELETE", url: getDeleteV1WebhookSubscriptionUrl().url.toString(), ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1335
1375
|
return res.data;
|
|
1336
1376
|
}
|
|
1337
1377
|
|
|
1338
1378
|
// src/generated/client/api/getV1ExerciseTemplates.ts
|
|
1339
1379
|
import fetch2 from "@kubb/plugin-client/clients/axios";
|
|
1340
1380
|
function getGetV1ExerciseTemplatesUrl() {
|
|
1341
|
-
|
|
1381
|
+
const res = { method: "GET", url: `/v1/exercise_templates` };
|
|
1382
|
+
return res;
|
|
1342
1383
|
}
|
|
1343
1384
|
async function getV1ExerciseTemplates(headers, params, config = {}) {
|
|
1344
1385
|
const { client: request = fetch2, ...requestConfig } = config;
|
|
1345
|
-
const res = await request({
|
|
1346
|
-
method: "GET",
|
|
1347
|
-
url: getGetV1ExerciseTemplatesUrl().toString(),
|
|
1348
|
-
params,
|
|
1349
|
-
...requestConfig,
|
|
1350
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1351
|
-
});
|
|
1386
|
+
const res = await request({ method: "GET", url: getGetV1ExerciseTemplatesUrl().url.toString(), params, ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1352
1387
|
return res.data;
|
|
1353
1388
|
}
|
|
1354
1389
|
|
|
1355
1390
|
// src/generated/client/api/getV1ExerciseTemplatesExercisetemplateid.ts
|
|
1356
1391
|
import fetch3 from "@kubb/plugin-client/clients/axios";
|
|
1357
1392
|
function getGetV1ExerciseTemplatesExercisetemplateidUrl(exerciseTemplateId) {
|
|
1358
|
-
|
|
1393
|
+
const res = { method: "GET", url: `/v1/exercise_templates/${exerciseTemplateId}` };
|
|
1394
|
+
return res;
|
|
1359
1395
|
}
|
|
1360
1396
|
async function getV1ExerciseTemplatesExercisetemplateid(exerciseTemplateId, headers, config = {}) {
|
|
1361
1397
|
const { client: request = fetch3, ...requestConfig } = config;
|
|
1362
|
-
const res = await request({
|
|
1363
|
-
method: "GET",
|
|
1364
|
-
url: getGetV1ExerciseTemplatesExercisetemplateidUrl(exerciseTemplateId).toString(),
|
|
1365
|
-
...requestConfig,
|
|
1366
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1367
|
-
});
|
|
1398
|
+
const res = await request({ method: "GET", url: getGetV1ExerciseTemplatesExercisetemplateidUrl(exerciseTemplateId).url.toString(), ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1368
1399
|
return res.data;
|
|
1369
1400
|
}
|
|
1370
1401
|
|
|
1371
1402
|
// src/generated/client/api/getV1RoutineFolders.ts
|
|
1372
1403
|
import fetch4 from "@kubb/plugin-client/clients/axios";
|
|
1373
1404
|
function getGetV1RoutineFoldersUrl() {
|
|
1374
|
-
|
|
1405
|
+
const res = { method: "GET", url: `/v1/routine_folders` };
|
|
1406
|
+
return res;
|
|
1375
1407
|
}
|
|
1376
1408
|
async function getV1RoutineFolders(headers, params, config = {}) {
|
|
1377
1409
|
const { client: request = fetch4, ...requestConfig } = config;
|
|
1378
|
-
const res = await request({
|
|
1379
|
-
method: "GET",
|
|
1380
|
-
url: getGetV1RoutineFoldersUrl().toString(),
|
|
1381
|
-
params,
|
|
1382
|
-
...requestConfig,
|
|
1383
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1384
|
-
});
|
|
1410
|
+
const res = await request({ method: "GET", url: getGetV1RoutineFoldersUrl().url.toString(), params, ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1385
1411
|
return res.data;
|
|
1386
1412
|
}
|
|
1387
1413
|
|
|
1388
1414
|
// src/generated/client/api/getV1RoutineFoldersFolderid.ts
|
|
1389
1415
|
import fetch5 from "@kubb/plugin-client/clients/axios";
|
|
1390
1416
|
function getGetV1RoutineFoldersFolderidUrl(folderId) {
|
|
1391
|
-
|
|
1417
|
+
const res = { method: "GET", url: `/v1/routine_folders/${folderId}` };
|
|
1418
|
+
return res;
|
|
1392
1419
|
}
|
|
1393
1420
|
async function getV1RoutineFoldersFolderid(folderId, headers, config = {}) {
|
|
1394
1421
|
const { client: request = fetch5, ...requestConfig } = config;
|
|
1395
|
-
const res = await request({
|
|
1396
|
-
method: "GET",
|
|
1397
|
-
url: getGetV1RoutineFoldersFolderidUrl(folderId).toString(),
|
|
1398
|
-
...requestConfig,
|
|
1399
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1400
|
-
});
|
|
1422
|
+
const res = await request({ method: "GET", url: getGetV1RoutineFoldersFolderidUrl(folderId).url.toString(), ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1401
1423
|
return res.data;
|
|
1402
1424
|
}
|
|
1403
1425
|
|
|
1404
1426
|
// src/generated/client/api/getV1Routines.ts
|
|
1405
1427
|
import fetch6 from "@kubb/plugin-client/clients/axios";
|
|
1406
1428
|
function getGetV1RoutinesUrl() {
|
|
1407
|
-
|
|
1429
|
+
const res = { method: "GET", url: `/v1/routines` };
|
|
1430
|
+
return res;
|
|
1408
1431
|
}
|
|
1409
1432
|
async function getV1Routines(headers, params, config = {}) {
|
|
1410
1433
|
const { client: request = fetch6, ...requestConfig } = config;
|
|
1411
|
-
const res = await request({
|
|
1412
|
-
method: "GET",
|
|
1413
|
-
url: getGetV1RoutinesUrl().toString(),
|
|
1414
|
-
params,
|
|
1415
|
-
...requestConfig,
|
|
1416
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1417
|
-
});
|
|
1434
|
+
const res = await request({ method: "GET", url: getGetV1RoutinesUrl().url.toString(), params, ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1418
1435
|
return res.data;
|
|
1419
1436
|
}
|
|
1420
1437
|
|
|
1421
1438
|
// src/generated/client/api/getV1RoutinesRoutineid.ts
|
|
1422
1439
|
import fetch7 from "@kubb/plugin-client/clients/axios";
|
|
1423
1440
|
function getGetV1RoutinesRoutineidUrl(routineId) {
|
|
1424
|
-
|
|
1441
|
+
const res = { method: "GET", url: `/v1/routines/${routineId}` };
|
|
1442
|
+
return res;
|
|
1425
1443
|
}
|
|
1426
1444
|
async function getV1RoutinesRoutineid(routineId, headers, config = {}) {
|
|
1427
1445
|
const { client: request = fetch7, ...requestConfig } = config;
|
|
1428
|
-
const res = await request({
|
|
1429
|
-
method: "GET",
|
|
1430
|
-
url: getGetV1RoutinesRoutineidUrl(routineId).toString(),
|
|
1431
|
-
...requestConfig,
|
|
1432
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1433
|
-
});
|
|
1446
|
+
const res = await request({ method: "GET", url: getGetV1RoutinesRoutineidUrl(routineId).url.toString(), ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1434
1447
|
return res.data;
|
|
1435
1448
|
}
|
|
1436
1449
|
|
|
1437
1450
|
// src/generated/client/api/getV1WebhookSubscription.ts
|
|
1438
1451
|
import fetch8 from "@kubb/plugin-client/clients/axios";
|
|
1439
1452
|
function getGetV1WebhookSubscriptionUrl() {
|
|
1440
|
-
|
|
1453
|
+
const res = { method: "GET", url: `/v1/webhook-subscription` };
|
|
1454
|
+
return res;
|
|
1441
1455
|
}
|
|
1442
1456
|
async function getV1WebhookSubscription(headers, config = {}) {
|
|
1443
1457
|
const { client: request = fetch8, ...requestConfig } = config;
|
|
1444
|
-
const res = await request({
|
|
1445
|
-
method: "GET",
|
|
1446
|
-
url: getGetV1WebhookSubscriptionUrl().toString(),
|
|
1447
|
-
...requestConfig,
|
|
1448
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1449
|
-
});
|
|
1458
|
+
const res = await request({ method: "GET", url: getGetV1WebhookSubscriptionUrl().url.toString(), ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1450
1459
|
return res.data;
|
|
1451
1460
|
}
|
|
1452
1461
|
|
|
1453
1462
|
// src/generated/client/api/getV1Workouts.ts
|
|
1454
1463
|
import fetch9 from "@kubb/plugin-client/clients/axios";
|
|
1455
1464
|
function getGetV1WorkoutsUrl() {
|
|
1456
|
-
|
|
1465
|
+
const res = { method: "GET", url: `/v1/workouts` };
|
|
1466
|
+
return res;
|
|
1457
1467
|
}
|
|
1458
1468
|
async function getV1Workouts(headers, params, config = {}) {
|
|
1459
1469
|
const { client: request = fetch9, ...requestConfig } = config;
|
|
1460
|
-
const res = await request({
|
|
1461
|
-
method: "GET",
|
|
1462
|
-
url: getGetV1WorkoutsUrl().toString(),
|
|
1463
|
-
params,
|
|
1464
|
-
...requestConfig,
|
|
1465
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1466
|
-
});
|
|
1470
|
+
const res = await request({ method: "GET", url: getGetV1WorkoutsUrl().url.toString(), params, ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1467
1471
|
return res.data;
|
|
1468
1472
|
}
|
|
1469
1473
|
|
|
1470
1474
|
// src/generated/client/api/getV1WorkoutsCount.ts
|
|
1471
1475
|
import fetch10 from "@kubb/plugin-client/clients/axios";
|
|
1472
1476
|
function getGetV1WorkoutsCountUrl() {
|
|
1473
|
-
|
|
1477
|
+
const res = { method: "GET", url: `/v1/workouts/count` };
|
|
1478
|
+
return res;
|
|
1474
1479
|
}
|
|
1475
1480
|
async function getV1WorkoutsCount(headers, config = {}) {
|
|
1476
1481
|
const { client: request = fetch10, ...requestConfig } = config;
|
|
1477
|
-
const res = await request({
|
|
1478
|
-
method: "GET",
|
|
1479
|
-
url: getGetV1WorkoutsCountUrl().toString(),
|
|
1480
|
-
...requestConfig,
|
|
1481
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1482
|
-
});
|
|
1482
|
+
const res = await request({ method: "GET", url: getGetV1WorkoutsCountUrl().url.toString(), ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1483
1483
|
return res.data;
|
|
1484
1484
|
}
|
|
1485
1485
|
|
|
1486
1486
|
// src/generated/client/api/getV1WorkoutsEvents.ts
|
|
1487
1487
|
import fetch11 from "@kubb/plugin-client/clients/axios";
|
|
1488
1488
|
function getGetV1WorkoutsEventsUrl() {
|
|
1489
|
-
|
|
1489
|
+
const res = { method: "GET", url: `/v1/workouts/events` };
|
|
1490
|
+
return res;
|
|
1490
1491
|
}
|
|
1491
1492
|
async function getV1WorkoutsEvents(headers, params, config = {}) {
|
|
1492
1493
|
const { client: request = fetch11, ...requestConfig } = config;
|
|
1493
|
-
const res = await request({
|
|
1494
|
-
method: "GET",
|
|
1495
|
-
url: getGetV1WorkoutsEventsUrl().toString(),
|
|
1496
|
-
params,
|
|
1497
|
-
...requestConfig,
|
|
1498
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1499
|
-
});
|
|
1494
|
+
const res = await request({ method: "GET", url: getGetV1WorkoutsEventsUrl().url.toString(), params, ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1500
1495
|
return res.data;
|
|
1501
1496
|
}
|
|
1502
1497
|
|
|
1503
1498
|
// src/generated/client/api/getV1WorkoutsWorkoutid.ts
|
|
1504
1499
|
import fetch12 from "@kubb/plugin-client/clients/axios";
|
|
1505
1500
|
function getGetV1WorkoutsWorkoutidUrl(workoutId) {
|
|
1506
|
-
|
|
1501
|
+
const res = { method: "GET", url: `/v1/workouts/${workoutId}` };
|
|
1502
|
+
return res;
|
|
1507
1503
|
}
|
|
1508
1504
|
async function getV1WorkoutsWorkoutid(workoutId, headers, config = {}) {
|
|
1509
1505
|
const { client: request = fetch12, ...requestConfig } = config;
|
|
1510
|
-
const res = await request({
|
|
1511
|
-
method: "GET",
|
|
1512
|
-
url: getGetV1WorkoutsWorkoutidUrl(workoutId).toString(),
|
|
1513
|
-
...requestConfig,
|
|
1514
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1515
|
-
});
|
|
1506
|
+
const res = await request({ method: "GET", url: getGetV1WorkoutsWorkoutidUrl(workoutId).url.toString(), ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1516
1507
|
return res.data;
|
|
1517
1508
|
}
|
|
1518
1509
|
|
|
1519
1510
|
// src/generated/client/api/postV1RoutineFolders.ts
|
|
1520
1511
|
import fetch13 from "@kubb/plugin-client/clients/axios";
|
|
1521
1512
|
function getPostV1RoutineFoldersUrl() {
|
|
1522
|
-
|
|
1513
|
+
const res = { method: "POST", url: `/v1/routine_folders` };
|
|
1514
|
+
return res;
|
|
1523
1515
|
}
|
|
1524
1516
|
async function postV1RoutineFolders(headers, data, config = {}) {
|
|
1525
1517
|
const { client: request = fetch13, ...requestConfig } = config;
|
|
1526
1518
|
const requestData = data;
|
|
1527
|
-
const res = await request({
|
|
1528
|
-
method: "POST",
|
|
1529
|
-
url: getPostV1RoutineFoldersUrl().toString(),
|
|
1530
|
-
data: requestData,
|
|
1531
|
-
...requestConfig,
|
|
1532
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1533
|
-
});
|
|
1519
|
+
const res = await request({ method: "POST", url: getPostV1RoutineFoldersUrl().url.toString(), data: requestData, ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1534
1520
|
return res.data;
|
|
1535
1521
|
}
|
|
1536
1522
|
|
|
1537
1523
|
// src/generated/client/api/postV1Routines.ts
|
|
1538
1524
|
import fetch14 from "@kubb/plugin-client/clients/axios";
|
|
1539
1525
|
function getPostV1RoutinesUrl() {
|
|
1540
|
-
|
|
1526
|
+
const res = { method: "POST", url: `/v1/routines` };
|
|
1527
|
+
return res;
|
|
1541
1528
|
}
|
|
1542
1529
|
async function postV1Routines(headers, data, config = {}) {
|
|
1543
1530
|
const { client: request = fetch14, ...requestConfig } = config;
|
|
1544
1531
|
const requestData = data;
|
|
1545
|
-
const res = await request({
|
|
1546
|
-
method: "POST",
|
|
1547
|
-
url: getPostV1RoutinesUrl().toString(),
|
|
1548
|
-
data: requestData,
|
|
1549
|
-
...requestConfig,
|
|
1550
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1551
|
-
});
|
|
1532
|
+
const res = await request({ method: "POST", url: getPostV1RoutinesUrl().url.toString(), data: requestData, ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1552
1533
|
return res.data;
|
|
1553
1534
|
}
|
|
1554
1535
|
|
|
1555
1536
|
// src/generated/client/api/postV1WebhookSubscription.ts
|
|
1556
1537
|
import fetch15 from "@kubb/plugin-client/clients/axios";
|
|
1557
1538
|
function getPostV1WebhookSubscriptionUrl() {
|
|
1558
|
-
|
|
1539
|
+
const res = { method: "POST", url: `/v1/webhook-subscription` };
|
|
1540
|
+
return res;
|
|
1559
1541
|
}
|
|
1560
1542
|
async function postV1WebhookSubscription(headers, data, config = {}) {
|
|
1561
1543
|
const { client: request = fetch15, ...requestConfig } = config;
|
|
1562
1544
|
const requestData = data;
|
|
1563
|
-
const res = await request({
|
|
1564
|
-
method: "POST",
|
|
1565
|
-
url: getPostV1WebhookSubscriptionUrl().toString(),
|
|
1566
|
-
data: requestData,
|
|
1567
|
-
...requestConfig,
|
|
1568
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1569
|
-
});
|
|
1545
|
+
const res = await request({ method: "POST", url: getPostV1WebhookSubscriptionUrl().url.toString(), data: requestData, ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1570
1546
|
return res.data;
|
|
1571
1547
|
}
|
|
1572
1548
|
|
|
1573
1549
|
// src/generated/client/api/postV1Workouts.ts
|
|
1574
1550
|
import fetch16 from "@kubb/plugin-client/clients/axios";
|
|
1575
1551
|
function getPostV1WorkoutsUrl() {
|
|
1576
|
-
|
|
1552
|
+
const res = { method: "POST", url: `/v1/workouts` };
|
|
1553
|
+
return res;
|
|
1577
1554
|
}
|
|
1578
1555
|
async function postV1Workouts(headers, data, config = {}) {
|
|
1579
1556
|
const { client: request = fetch16, ...requestConfig } = config;
|
|
1580
1557
|
const requestData = data;
|
|
1581
|
-
const res = await request({
|
|
1582
|
-
method: "POST",
|
|
1583
|
-
url: getPostV1WorkoutsUrl().toString(),
|
|
1584
|
-
data: requestData,
|
|
1585
|
-
...requestConfig,
|
|
1586
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1587
|
-
});
|
|
1558
|
+
const res = await request({ method: "POST", url: getPostV1WorkoutsUrl().url.toString(), data: requestData, ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1588
1559
|
return res.data;
|
|
1589
1560
|
}
|
|
1590
1561
|
|
|
1591
1562
|
// src/generated/client/api/putV1RoutinesRoutineid.ts
|
|
1592
1563
|
import fetch17 from "@kubb/plugin-client/clients/axios";
|
|
1593
1564
|
function getPutV1RoutinesRoutineidUrl(routineId) {
|
|
1594
|
-
|
|
1565
|
+
const res = { method: "PUT", url: `/v1/routines/${routineId}` };
|
|
1566
|
+
return res;
|
|
1595
1567
|
}
|
|
1596
1568
|
async function putV1RoutinesRoutineid(routineId, headers, data, config = {}) {
|
|
1597
1569
|
const { client: request = fetch17, ...requestConfig } = config;
|
|
1598
1570
|
const requestData = data;
|
|
1599
|
-
const res = await request({
|
|
1600
|
-
method: "PUT",
|
|
1601
|
-
url: getPutV1RoutinesRoutineidUrl(routineId).toString(),
|
|
1602
|
-
data: requestData,
|
|
1603
|
-
...requestConfig,
|
|
1604
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1605
|
-
});
|
|
1571
|
+
const res = await request({ method: "PUT", url: getPutV1RoutinesRoutineidUrl(routineId).url.toString(), data: requestData, ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1606
1572
|
return res.data;
|
|
1607
1573
|
}
|
|
1608
1574
|
|
|
1609
1575
|
// src/generated/client/api/putV1WorkoutsWorkoutid.ts
|
|
1610
1576
|
import fetch18 from "@kubb/plugin-client/clients/axios";
|
|
1611
1577
|
function getPutV1WorkoutsWorkoutidUrl(workoutId) {
|
|
1612
|
-
|
|
1578
|
+
const res = { method: "PUT", url: `/v1/workouts/${workoutId}` };
|
|
1579
|
+
return res;
|
|
1613
1580
|
}
|
|
1614
1581
|
async function putV1WorkoutsWorkoutid(workoutId, headers, data, config = {}) {
|
|
1615
1582
|
const { client: request = fetch18, ...requestConfig } = config;
|
|
1616
1583
|
const requestData = data;
|
|
1617
|
-
const res = await request({
|
|
1618
|
-
method: "PUT",
|
|
1619
|
-
url: getPutV1WorkoutsWorkoutidUrl(workoutId).toString(),
|
|
1620
|
-
data: requestData,
|
|
1621
|
-
...requestConfig,
|
|
1622
|
-
headers: { ...headers, ...requestConfig.headers }
|
|
1623
|
-
});
|
|
1584
|
+
const res = await request({ method: "PUT", url: getPutV1WorkoutsWorkoutidUrl(workoutId).url.toString(), data: requestData, ...requestConfig, headers: { ...headers, ...requestConfig.headers } });
|
|
1624
1585
|
return res.data;
|
|
1625
1586
|
}
|
|
1626
1587
|
|
|
1627
1588
|
// src/utils/hevyClientKubb.ts
|
|
1628
|
-
function createClient(
|
|
1589
|
+
function createClient(apiKey, baseUrl = "https://api.hevyapp.com") {
|
|
1629
1590
|
const axiosInstance = axios.create({
|
|
1630
1591
|
baseURL: baseUrl,
|
|
1631
1592
|
headers: {
|
|
1632
|
-
"api-key":
|
|
1593
|
+
"api-key": apiKey
|
|
1633
1594
|
}
|
|
1634
1595
|
});
|
|
1635
1596
|
const headers = {
|
|
1636
|
-
"api-key":
|
|
1597
|
+
"api-key": apiKey
|
|
1637
1598
|
};
|
|
1638
1599
|
const client = axiosInstance;
|
|
1639
1600
|
return {
|
|
@@ -1672,8 +1633,8 @@ function createClient(apiKey2, baseUrl = "https://api.hevyapp.com") {
|
|
|
1672
1633
|
}
|
|
1673
1634
|
|
|
1674
1635
|
// src/utils/hevyClient.ts
|
|
1675
|
-
function createClient2(
|
|
1676
|
-
return createClient(
|
|
1636
|
+
function createClient2(apiKey, baseUrl) {
|
|
1637
|
+
return createClient(apiKey, baseUrl);
|
|
1677
1638
|
}
|
|
1678
1639
|
|
|
1679
1640
|
// src/utils/httpServer.ts
|
|
@@ -1701,13 +1662,46 @@ function createHttpServer(server2, options) {
|
|
|
1701
1662
|
const port = options?.port || 3e3;
|
|
1702
1663
|
const host = options?.host || "127.0.0.1";
|
|
1703
1664
|
app.use(express.json());
|
|
1665
|
+
app.use("/mcp", (req, res, next) => {
|
|
1666
|
+
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
1667
|
+
res.setHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS");
|
|
1668
|
+
res.setHeader(
|
|
1669
|
+
"Access-Control-Allow-Headers",
|
|
1670
|
+
"Content-Type, mcp-session-id"
|
|
1671
|
+
);
|
|
1672
|
+
res.setHeader(
|
|
1673
|
+
"Access-Control-Expose-Headers",
|
|
1674
|
+
"mcp-session-id, mcp-protocol-version"
|
|
1675
|
+
);
|
|
1676
|
+
if (req.method === "OPTIONS") {
|
|
1677
|
+
res.status(204).end();
|
|
1678
|
+
return;
|
|
1679
|
+
}
|
|
1680
|
+
next();
|
|
1681
|
+
});
|
|
1704
1682
|
app.post("/mcp", async (req, res) => {
|
|
1705
1683
|
const sessionId = req.headers["mcp-session-id"];
|
|
1706
1684
|
let transport;
|
|
1707
1685
|
if (sessionId && transports.has(sessionId)) {
|
|
1708
|
-
|
|
1709
|
-
|
|
1686
|
+
const existingSession = transports.get(sessionId);
|
|
1687
|
+
if (!existingSession) {
|
|
1688
|
+
res.status(400).json({
|
|
1689
|
+
jsonrpc: "2.0",
|
|
1690
|
+
error: {
|
|
1691
|
+
code: -32e3,
|
|
1692
|
+
message: "Bad Request: Session lookup failed"
|
|
1693
|
+
},
|
|
1694
|
+
id: null
|
|
1695
|
+
});
|
|
1696
|
+
return;
|
|
1697
|
+
}
|
|
1698
|
+
transport = existingSession.transport;
|
|
1699
|
+
existingSession.lastActivity = Date.now();
|
|
1710
1700
|
} else if (!sessionId && isInitializeRequest(req.body)) {
|
|
1701
|
+
const queryApiKey = req.query.HEVY_API_KEY;
|
|
1702
|
+
if (queryApiKey && options?.onFirstRequestApiKey) {
|
|
1703
|
+
options.onFirstRequestApiKey(queryApiKey);
|
|
1704
|
+
}
|
|
1711
1705
|
transport = new StreamableHTTPServerTransport({
|
|
1712
1706
|
sessionIdGenerator: () => randomUUID(),
|
|
1713
1707
|
onsessioninitialized: (sessionId2) => {
|
|
@@ -1743,7 +1737,9 @@ function createHttpServer(server2, options) {
|
|
|
1743
1737
|
return;
|
|
1744
1738
|
}
|
|
1745
1739
|
const transport = transports.get(sessionId)?.transport;
|
|
1746
|
-
|
|
1740
|
+
if (transport) {
|
|
1741
|
+
await transport.handleRequest(req, res);
|
|
1742
|
+
}
|
|
1747
1743
|
};
|
|
1748
1744
|
app.get("/mcp", handleSessionRequest);
|
|
1749
1745
|
app.delete("/mcp", handleSessionRequest);
|
|
@@ -1784,9 +1780,23 @@ var server = new McpServer({
|
|
|
1784
1780
|
name,
|
|
1785
1781
|
version
|
|
1786
1782
|
});
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1783
|
+
var hevyClient = null;
|
|
1784
|
+
function initializeClient(apiKey) {
|
|
1785
|
+
if (!hevyClient) {
|
|
1786
|
+
assertApiKey(apiKey);
|
|
1787
|
+
hevyClient = createClient2(apiKey, HEVY_API_BASEURL);
|
|
1788
|
+
console.log("Hevy client initialized with API key");
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
if (cfg.transportMode === "stdio") {
|
|
1792
|
+
initializeClient(cfg.apiKey);
|
|
1793
|
+
} else if (cfg.apiKey) {
|
|
1794
|
+
initializeClient(cfg.apiKey);
|
|
1795
|
+
} else {
|
|
1796
|
+
console.log(
|
|
1797
|
+
"Starting in HTTP mode without API key. Waiting for API key via query parameter on first request."
|
|
1798
|
+
);
|
|
1799
|
+
}
|
|
1790
1800
|
registerWorkoutTools(server, hevyClient);
|
|
1791
1801
|
registerRoutineTools(server, hevyClient);
|
|
1792
1802
|
registerTemplateTools(server, hevyClient);
|
|
@@ -1801,7 +1811,18 @@ async function runServer() {
|
|
|
1801
1811
|
port: cfg.httpPort,
|
|
1802
1812
|
host: cfg.httpHost,
|
|
1803
1813
|
enableDnsRebindingProtection: cfg.enableDnsRebindingProtection,
|
|
1804
|
-
allowedHosts: cfg.allowedHosts
|
|
1814
|
+
allowedHosts: cfg.allowedHosts,
|
|
1815
|
+
// Callback to handle API key from query params
|
|
1816
|
+
onFirstRequestApiKey: (apiKey) => {
|
|
1817
|
+
if (!hevyClient) {
|
|
1818
|
+
initializeClient(apiKey);
|
|
1819
|
+
registerWorkoutTools(server, hevyClient);
|
|
1820
|
+
registerRoutineTools(server, hevyClient);
|
|
1821
|
+
registerTemplateTools(server, hevyClient);
|
|
1822
|
+
registerFolderTools(server, hevyClient);
|
|
1823
|
+
registerWebhookTools(server, hevyClient);
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1805
1826
|
});
|
|
1806
1827
|
await httpServer.startServer();
|
|
1807
1828
|
} else {
|