yazio-mcp 0.0.16-beta.1 → 0.0.16

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 CHANGED
@@ -93,7 +93,8 @@ Easily log meals you forgot to track in the Yazio app directly from Claude or Cu
93
93
  | `get_user` | Get user profile | - |
94
94
  | `get_user_daily_summary` | Get daily nutrition summary | `date` |
95
95
  | `get_user_consumed_items` | Get food entries for a date | `date` |
96
- | `get_user_weight` | Get weight data | `date` (optional) |
96
+ | `get_user_weight` | Get the last weight entry up to a date | `date` (optional) |
97
+ | `get_user_weight_history` | Get all weight entries in a date range | `start`, `end` (optional) |
97
98
  | `get_user_exercises` | Get exercise data | `date` |
98
99
  | `get_user_water_intake` | Get water intake | `date` |
99
100
  | `get_user_goals` | Get nutrition goals | `date` (optional) |
@@ -1,4 +1,5 @@
1
1
  import * as z from 'zod';
2
+ export declare const DateTimeStringSchema: z.ZodPipe<z.ZodString, z.ZodTransform<`${string}-${string}-${string} ${string}:${string}:${string}`, string>>;
2
3
  export declare const DaytimeSchema: z.ZodEnum<{
3
4
  breakfast: "breakfast";
4
5
  lunch: "lunch";
@@ -100,14 +101,14 @@ export declare const UserSchema: z.ZodObject<{
100
101
  name: z.ZodString;
101
102
  }, z.core.$loose>>;
102
103
  email: z.ZodString;
103
- premium_type: z.ZodString;
104
+ premium_type: z.ZodNullable<z.ZodString>;
104
105
  sex: z.ZodEnum<{
105
106
  male: "male";
106
107
  female: "female";
107
108
  other: "other";
108
109
  }>;
109
110
  first_name: z.ZodString;
110
- last_name: z.ZodString;
111
+ last_name: z.ZodNullable<z.ZodString>;
111
112
  city: z.ZodString;
112
113
  country: z.ZodString;
113
114
  weight_change_per_week: z.ZodNumber;
@@ -224,9 +225,13 @@ export declare const DailySummarySchema: z.ZodObject<{
224
225
  }, z.core.$loose>;
225
226
  active_fasting_countdown_template_key: z.ZodNullable<z.ZodString>;
226
227
  }, z.core.$loose>;
228
+ export declare const WeightHistorySchema: z.ZodArray<z.ZodObject<{
229
+ date: z.ZodPipe<z.ZodString, z.ZodTransform<`${string}-${string}-${string} ${string}:${string}:${string}`, string>>;
230
+ value: z.ZodNumber;
231
+ }, z.core.$loose>>;
227
232
  export declare const WeightEntrySchema: z.ZodObject<{
228
233
  id: z.ZodString;
229
- date: z.ZodString;
234
+ date: z.ZodPipe<z.ZodString, z.ZodTransform<`${string}-${string}-${string} ${string}:${string}:${string}`, string>>;
230
235
  value: z.ZodNullable<z.ZodNumber>;
231
236
  external_id: z.ZodNullable<z.ZodString>;
232
237
  gateway: z.ZodNullable<z.ZodString>;
@@ -274,7 +279,7 @@ export declare const WaterIntakeSchema: z.ZodObject<{
274
279
  export declare const ConsumedItemsSchema: z.ZodObject<{
275
280
  products: z.ZodArray<z.ZodObject<{
276
281
  id: z.ZodString;
277
- date: z.ZodString;
282
+ date: z.ZodPipe<z.ZodString, z.ZodTransform<`${string}-${string}-${string} ${string}:${string}:${string}`, string>>;
278
283
  daytime: z.ZodEnum<{
279
284
  breakfast: "breakfast";
280
285
  lunch: "lunch";
@@ -289,7 +294,7 @@ export declare const ConsumedItemsSchema: z.ZodObject<{
289
294
  }, z.core.$loose>>;
290
295
  recipe_portions: z.ZodArray<z.ZodObject<{
291
296
  id: z.ZodString;
292
- date: z.ZodString;
297
+ date: z.ZodPipe<z.ZodString, z.ZodTransform<`${string}-${string}-${string} ${string}:${string}:${string}`, string>>;
293
298
  daytime: z.ZodEnum<{
294
299
  breakfast: "breakfast";
295
300
  lunch: "lunch";
@@ -302,7 +307,7 @@ export declare const ConsumedItemsSchema: z.ZodObject<{
302
307
  }, z.core.$loose>>;
303
308
  simple_products: z.ZodArray<z.ZodObject<{
304
309
  id: z.ZodString;
305
- date: z.ZodString;
310
+ date: z.ZodPipe<z.ZodString, z.ZodTransform<`${string}-${string}-${string} ${string}:${string}:${string}`, string>>;
306
311
  daytime: z.ZodEnum<{
307
312
  breakfast: "breakfast";
308
313
  lunch: "lunch";
@@ -335,7 +340,6 @@ export declare const ProductSearchResultsSchema: z.ZodArray<z.ZodObject<{
335
340
  language: z.ZodString;
336
341
  }, z.core.$loose>>;
337
342
  export declare const ProductSchema: z.ZodObject<{
338
- id: z.ZodString;
339
343
  name: z.ZodString;
340
344
  is_verified: z.ZodBoolean;
341
345
  is_private: z.ZodBoolean;
@@ -6,6 +6,7 @@ export type YazioDietaryPreferences = z.infer<typeof S.DietaryPreferencesSchema>
6
6
  export type YazioGoals = z.infer<typeof S.GoalsSchema>;
7
7
  export type YazioDailySummary = z.infer<typeof S.DailySummarySchema>;
8
8
  export type YazioWeightEntry = z.infer<typeof S.WeightEntrySchema>;
9
+ export type YazioWeightHistory = z.infer<typeof S.WeightHistorySchema>;
9
10
  export type YazioExercises = z.infer<typeof S.ExercisesSchema>;
10
11
  export type YazioSuggestedProduct = z.infer<typeof S.SuggestedProductsSchema>[number];
11
12
  export type YazioWaterIntake = z.infer<typeof S.WaterIntakeSchema>;
@@ -14,10 +14,10 @@ export declare class YazioApi {
14
14
  name: string;
15
15
  } | null;
16
16
  email: string;
17
- premium_type: string;
17
+ premium_type: string | null;
18
18
  sex: "male" | "female" | "other";
19
19
  first_name: string;
20
- last_name: string;
20
+ last_name: string | null;
21
21
  city: string;
22
22
  country: string;
23
23
  weight_change_per_week: number;
@@ -153,12 +153,18 @@ export declare class YazioApi {
153
153
  getLastWeight: (date?: string) => Promise<{
154
154
  [x: string]: unknown;
155
155
  id: string;
156
- date: string;
156
+ date: `${string}-${string}-${string} ${string}:${string}:${string}`;
157
157
  value: number | null;
158
158
  external_id: string | null;
159
159
  gateway: string | null;
160
160
  source: string | null;
161
161
  } | null>;
162
+ /** Every entry between the dates, both included; a day can have several */
163
+ getWeightHistory: (start: string, end?: string) => Promise<{
164
+ [x: string]: unknown;
165
+ date: `${string}-${string}-${string} ${string}:${string}:${string}`;
166
+ value: number;
167
+ }[]>;
162
168
  getExercises: (date?: string) => Promise<{
163
169
  [x: string]: unknown;
164
170
  training: {
@@ -202,7 +208,7 @@ export declare class YazioApi {
202
208
  products: {
203
209
  [x: string]: unknown;
204
210
  id: string;
205
- date: string;
211
+ date: `${string}-${string}-${string} ${string}:${string}:${string}`;
206
212
  daytime: "breakfast" | "lunch" | "dinner" | "snack";
207
213
  type: string;
208
214
  product_id: string;
@@ -213,7 +219,7 @@ export declare class YazioApi {
213
219
  recipe_portions: {
214
220
  [x: string]: unknown;
215
221
  id: string;
216
- date: string;
222
+ date: `${string}-${string}-${string} ${string}:${string}:${string}`;
217
223
  daytime: "breakfast" | "lunch" | "dinner" | "snack";
218
224
  recipe_id: string;
219
225
  portion_count: number;
@@ -222,7 +228,7 @@ export declare class YazioApi {
222
228
  simple_products: {
223
229
  [x: string]: unknown;
224
230
  id: string;
225
- date: string;
231
+ date: `${string}-${string}-${string} ${string}:${string}:${string}`;
226
232
  daytime: "breakfast" | "lunch" | "dinner" | "snack";
227
233
  name: string;
228
234
  nutrients: Record<string, number>;
@@ -263,7 +269,6 @@ export declare class YazioApi {
263
269
  }[]>;
264
270
  getProduct: (id: string) => Promise<{
265
271
  [x: string]: unknown;
266
- id: string;
267
272
  name: string;
268
273
  is_verified: boolean;
269
274
  is_private: boolean;
package/dist/index.js CHANGED
@@ -22139,6 +22139,7 @@ function v4(options, buf, offset) {
22139
22139
  var v4_default = v4;
22140
22140
 
22141
22141
  // src/api/schemas.ts
22142
+ var DateTimeStringSchema = string2().regex(/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]) ([01]\d|2[0-3]):[0-5]\d:[0-5]\d$/).transform((value) => value);
22142
22143
  var DaytimeSchema = _enum(["breakfast", "lunch", "dinner", "snack"]);
22143
22144
  var ProductCategorySchema = _enum([
22144
22145
  "babyfood",
@@ -22231,10 +22232,10 @@ var UserSchema = looseObject({
22231
22232
  name: string2()
22232
22233
  }).nullable(),
22233
22234
  email: string2(),
22234
- premium_type: string2(),
22235
+ premium_type: string2().nullable(),
22235
22236
  sex: _enum(["male", "female", "other"]),
22236
22237
  first_name: string2(),
22237
- last_name: string2(),
22238
+ last_name: string2().nullable(),
22238
22239
  city: string2(),
22239
22240
  country: string2(),
22240
22241
  weight_change_per_week: number2(),
@@ -22315,9 +22316,10 @@ var DailySummarySchema = looseObject({
22315
22316
  }),
22316
22317
  active_fasting_countdown_template_key: string2().nullable()
22317
22318
  });
22319
+ var WeightHistorySchema = array(looseObject({ date: DateTimeStringSchema, value: number2() }));
22318
22320
  var WeightEntrySchema = looseObject({
22319
22321
  id: string2(),
22320
- date: string2(),
22322
+ date: DateTimeStringSchema,
22321
22323
  value: number2().nullable(),
22322
22324
  external_id: string2().nullable(),
22323
22325
  gateway: string2().nullable(),
@@ -22355,7 +22357,7 @@ var WaterIntakeSchema = looseObject({
22355
22357
  });
22356
22358
  var ConsumedProductSchema = looseObject({
22357
22359
  id: string2(),
22358
- date: string2(),
22360
+ date: DateTimeStringSchema,
22359
22361
  daytime: DaytimeSchema,
22360
22362
  type: string2(),
22361
22363
  product_id: string2(),
@@ -22365,7 +22367,7 @@ var ConsumedProductSchema = looseObject({
22365
22367
  });
22366
22368
  var ConsumedRecipePortionSchema = looseObject({
22367
22369
  id: string2(),
22368
- date: string2(),
22370
+ date: DateTimeStringSchema,
22369
22371
  daytime: DaytimeSchema,
22370
22372
  type: string2().optional(),
22371
22373
  recipe_id: string2(),
@@ -22373,7 +22375,7 @@ var ConsumedRecipePortionSchema = looseObject({
22373
22375
  });
22374
22376
  var ConsumedSimpleProductSchema = looseObject({
22375
22377
  id: string2(),
22376
- date: string2(),
22378
+ date: DateTimeStringSchema,
22377
22379
  daytime: DaytimeSchema,
22378
22380
  type: string2().optional(),
22379
22381
  name: string2(),
@@ -22402,7 +22404,6 @@ var ProductSearchResultsSchema = array(
22402
22404
  })
22403
22405
  );
22404
22406
  var ProductSchema = looseObject({
22405
- id: string2(),
22406
22407
  name: string2(),
22407
22408
  is_verified: boolean2(),
22408
22409
  is_private: boolean2(),
@@ -22475,6 +22476,10 @@ var GetUserInfoInputSchema = EmptyInputSchema;
22475
22476
  var GetUserWeightInputSchema = object({
22476
22477
  date: DateStringSchema.optional().describe("Returns the last weight entry up to this date (defaults to today)")
22477
22478
  });
22479
+ var GetUserWeightHistoryInputSchema = object({
22480
+ start: DateStringSchema.describe("First date, included"),
22481
+ end: DateStringSchema.optional().describe("Last date, included (defaults to today)")
22482
+ });
22478
22483
  var GetWaterIntakeInputSchema = DateInputSchema;
22479
22484
  var SearchProductsInputSchema = QueryInputSchema;
22480
22485
  function lenient(schema) {
@@ -22511,7 +22516,6 @@ var GetUserSuggestedProductsInputSchema = object({
22511
22516
  daytime: DaytimeSchema.optional().describe("Meal to get suggestions for (defaults to breakfast)"),
22512
22517
  limit: LimitSchema
22513
22518
  });
22514
- var DateTimeStringSchema = string2().regex(/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]) ([01]\d|2[0-3]):[0-5]\d:[0-5]\d$/).transform((value) => value);
22515
22519
  var ConsumedAtSchema = union([DateStringSchema, DateTimeStringSchema]).describe('Date and time when the food was consumed in "YYYY-MM-DD HH:mm:ss" format (e.g., "2025-12-18 12:30:00"), or date only in YYYY-MM-DD format');
22516
22520
  var AddConsumedItemInputSchema = object({
22517
22521
  // id: ProductIdSchema.describe('Random identifier for the consumed item'),
@@ -22731,6 +22735,8 @@ var YazioApi = class {
22731
22735
  getGoals = (date5 = today()) => this.http.request("GET", "/user/goals/unmodified", { query: { date: date5 }, schema: GoalsSchema });
22732
22736
  getDailySummary = (date5) => this.http.request("GET", "/user/widgets/daily-summary", { query: { date: date5 }, schema: DailySummarySchema });
22733
22737
  getLastWeight = (date5 = today()) => this.http.request("GET", "/user/bodyvalues/weight/last", { query: { date: date5 }, schema: WeightEntrySchema.nullable() });
22738
+ /** Every entry between the dates, both included; a day can have several */
22739
+ getWeightHistory = (start, end = today()) => this.http.request("GET", "/user/bodyvalues/weight", { query: { start, end }, schema: WeightHistorySchema });
22734
22740
  getExercises = (date5 = today()) => this.http.request("GET", "/user/exercises", { query: { date: date5 }, schema: ExercisesSchema });
22735
22741
  getSuggestedProducts = (daytime, date5 = today()) => this.http.request("GET", "/user/products/suggested", { query: { date: date5, daytime }, schema: SuggestedProductsSchema });
22736
22742
  getConsumedItems = (date5) => this.http.request("GET", "/user/consumed-items", { query: { date: date5 }, schema: ConsumedItemsSchema });
@@ -22955,7 +22961,7 @@ var YazioMcpServer = class {
22955
22961
  "get_user_weight",
22956
22962
  {
22957
22963
  title: "Get Weight",
22958
- description: "Get user weight data",
22964
+ description: "Get the last weight entry up to a date. Use get_user_weight_history for all entries in a date range.",
22959
22965
  inputSchema: GetUserWeightInputSchema,
22960
22966
  annotations: {
22961
22967
  readOnlyHint: true,
@@ -22966,6 +22972,21 @@ var YazioMcpServer = class {
22966
22972
  return await this.getUserWeight(args);
22967
22973
  }
22968
22974
  );
22975
+ server.registerTool(
22976
+ "get_user_weight_history",
22977
+ {
22978
+ title: "Get Weight History",
22979
+ description: "Get all weight entries between two dates in one call, e.g. for trends. A day can have several entries at different times.",
22980
+ inputSchema: GetUserWeightHistoryInputSchema,
22981
+ annotations: {
22982
+ readOnlyHint: true,
22983
+ idempotentHint: true
22984
+ }
22985
+ },
22986
+ async (args) => {
22987
+ return await this.getUserWeightHistory(args);
22988
+ }
22989
+ );
22969
22990
  server.registerTool(
22970
22991
  "get_user_daily_summary",
22971
22992
  {
@@ -23437,6 +23458,24 @@ ${JSON.stringify(weight, null, 2)}`
23437
23458
  throw new Error(`Failed to get user weight: ${error2}`);
23438
23459
  }
23439
23460
  }
23461
+ async getUserWeightHistory(args) {
23462
+ const client = await this.ensureAuthenticated();
23463
+ try {
23464
+ const entries = await client.getWeightHistory(args.start, args.end);
23465
+ return {
23466
+ content: [
23467
+ {
23468
+ type: "text",
23469
+ text: `Weight entries (${entries.length}):
23470
+
23471
+ ${JSON.stringify(entries, null, 2)}`
23472
+ }
23473
+ ]
23474
+ };
23475
+ } catch (error2) {
23476
+ throw new Error(`Failed to get weight history: ${error2}`);
23477
+ }
23478
+ }
23440
23479
  async getUserWaterIntake(args) {
23441
23480
  const client = await this.ensureAuthenticated();
23442
23481
  try {
package/dist/schemas.d.ts CHANGED
@@ -33,6 +33,10 @@ export declare const GetUserInfoInputSchema: z.ZodObject<{}, z.core.$strip>;
33
33
  export declare const GetUserWeightInputSchema: z.ZodObject<{
34
34
  date: z.ZodOptional<z.ZodISODate>;
35
35
  }, z.core.$strip>;
36
+ export declare const GetUserWeightHistoryInputSchema: z.ZodObject<{
37
+ start: z.ZodISODate;
38
+ end: z.ZodOptional<z.ZodISODate>;
39
+ }, z.core.$strip>;
36
40
  export declare const GetWaterIntakeInputSchema: z.ZodObject<{
37
41
  date: z.ZodISODate;
38
42
  }, z.core.$strip>;
@@ -215,6 +219,7 @@ export type GetFoodEntriesInput = z.infer<typeof GetFoodEntriesInputSchema>;
215
219
  export type GetDailySummaryInput = z.infer<typeof GetDailySummaryInputSchema>;
216
220
  export type GetUserInfoInput = z.infer<typeof GetUserInfoInputSchema>;
217
221
  export type GetUserWeightInput = z.infer<typeof GetUserWeightInputSchema>;
222
+ export type GetUserWeightHistoryInput = z.infer<typeof GetUserWeightHistoryInputSchema>;
218
223
  export type GetWaterIntakeInput = z.infer<typeof GetWaterIntakeInputSchema>;
219
224
  export type SearchProductsInput = z.infer<typeof SearchProductsInputSchema>;
220
225
  export type GetProductInput = z.infer<typeof GetProductInputSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yazio-mcp",
3
- "version": "0.0.16-beta.1",
3
+ "version": "0.0.16",
4
4
  "description": "MCP server for accessing Yazio user & nutrition data (unofficial)",
5
5
  "mcpName": "io.github.fliptheweb/yazio-mcp",
6
6
  "author": "fliptheweb",