yazio-mcp 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +30 -16
- package/dist/schemas.d.ts +8 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30101,7 +30101,7 @@ var ProductIdSchema = uuid2().describe("Product UUID v1/v4 (e.g. 4ceff6e9-78ce-4
|
|
|
30101
30101
|
var ItemIdSchema = ProductIdSchema.describe("Unique item identifier");
|
|
30102
30102
|
var ServingTypeSchema = string2().describe("Serving type (e.g. portion, fruit, glass, cup, slice, piece, bar, gram, bottle, can, etc.)");
|
|
30103
30103
|
var QueryStringSchema = string2().describe("Search query string");
|
|
30104
|
-
var LimitSchema = number2().optional().describe("Maximum number of results to return");
|
|
30104
|
+
var LimitSchema = number2().int().positive().optional().describe("Maximum number of results to return");
|
|
30105
30105
|
var DateInputSchema = object2({
|
|
30106
30106
|
date: DateStringSchema
|
|
30107
30107
|
});
|
|
@@ -30114,10 +30114,6 @@ var QueryInputSchema = object2({
|
|
|
30114
30114
|
countries: array(string2()).default(["US"]).optional().describe('Array of country codes for product search (e.g. ["US", "DE", "TR"])'),
|
|
30115
30115
|
locales: array(string2()).default(["en_US"]).optional().describe('Array of locale codes (e.g. ["en_US", "de_US"])')
|
|
30116
30116
|
});
|
|
30117
|
-
var OptionalQueryInputSchema = object2({
|
|
30118
|
-
query: QueryStringSchema.optional().describe("Search query (optional)"),
|
|
30119
|
-
limit: LimitSchema
|
|
30120
|
-
});
|
|
30121
30117
|
var EmptyInputSchema = object2({});
|
|
30122
30118
|
var GetFoodEntriesInputSchema = DateInputSchema;
|
|
30123
30119
|
var GetDailySummaryInputSchema = DateInputSchema;
|
|
@@ -30146,11 +30142,15 @@ var GetProductInputSchema = object2({
|
|
|
30146
30142
|
});
|
|
30147
30143
|
var GetUserExercisesInputSchema = OptionalDateInputSchema;
|
|
30148
30144
|
var GetUserSettingsInputSchema = EmptyInputSchema;
|
|
30149
|
-
var GetUserSuggestedProductsInputSchema =
|
|
30145
|
+
var GetUserSuggestedProductsInputSchema = object2({
|
|
30146
|
+
date: DateStringSchema.optional().describe("Date to get suggestions for (defaults to today)"),
|
|
30147
|
+
daytime: DaytimeSchema.optional().describe("Meal to get suggestions for (defaults to breakfast)"),
|
|
30148
|
+
limit: LimitSchema
|
|
30149
|
+
});
|
|
30150
30150
|
var AddConsumedItemInputSchema = object2({
|
|
30151
30151
|
// id: ProductIdSchema.describe('Random identifier for the consumed item'),
|
|
30152
30152
|
product_id: ProductIdSchema,
|
|
30153
|
-
date: DateStringSchema.describe(
|
|
30153
|
+
date: union([DateStringSchema, string2().regex(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/)]).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'),
|
|
30154
30154
|
daytime: DaytimeSchema.describe("Type of meal (breakfast, lunch, dinner, snack)"),
|
|
30155
30155
|
amount: number2().describe("Amount of the product consumed in base units (g or ml)"),
|
|
30156
30156
|
serving: ServingTypeSchema.optional(),
|
|
@@ -30320,7 +30320,7 @@ var YazioMcpServer = class {
|
|
|
30320
30320
|
this.server.registerTool(
|
|
30321
30321
|
"get_user_suggested_products",
|
|
30322
30322
|
{
|
|
30323
|
-
description: "Get product suggestions for the user",
|
|
30323
|
+
description: "Get product suggestions for the user for a meal (daytime) on a date",
|
|
30324
30324
|
inputSchema: GetUserSuggestedProductsInputSchema,
|
|
30325
30325
|
annotations: {
|
|
30326
30326
|
readOnlyHint: true,
|
|
@@ -30408,7 +30408,7 @@ var YazioMcpServer = class {
|
|
|
30408
30408
|
this.server.registerTool(
|
|
30409
30409
|
"add_user_consumed_item",
|
|
30410
30410
|
{
|
|
30411
|
-
description:
|
|
30411
|
+
description: 'Add a food item to user consumption log. Pass date with time ("YYYY-MM-DD HH:mm:ss") to keep the time of the entry; date only (YYYY-MM-DD) logs it at 00:00.',
|
|
30412
30412
|
inputSchema: AddConsumedItemInputSchema,
|
|
30413
30413
|
annotations: {
|
|
30414
30414
|
readOnlyHint: false,
|
|
@@ -30477,7 +30477,7 @@ var YazioMcpServer = class {
|
|
|
30477
30477
|
|
|
30478
30478
|
5. **Add the consumed item**: Use the \`add_user_consumed_item\` tool with:
|
|
30479
30479
|
- \`product_id\`: The UUID from step 1
|
|
30480
|
-
- \`date\`: Date in YYYY-MM-DD format
|
|
30480
|
+
- \`date\`: Date and time in "YYYY-MM-DD HH:mm:ss" format (or date only in YYYY-MM-DD format)
|
|
30481
30481
|
- \`daytime\`: One of: "breakfast", "lunch", "dinner", or "snack"
|
|
30482
30482
|
- \`serving\`: Use a serving type from step 2 (e.g., "portion", "piece", "cup") OR base unit (g or ml)
|
|
30483
30483
|
- \`serving_quantity\`: Quantity of the serving type (e.g., 1, 2, 0.5)
|
|
@@ -30486,7 +30486,7 @@ var YazioMcpServer = class {
|
|
|
30486
30486
|
**Important Notes**:
|
|
30487
30487
|
- Always search first if you don't have a product_id
|
|
30488
30488
|
- Check product details to understand available serving types, base unit (g or ml) and amount in serving
|
|
30489
|
-
- The date should
|
|
30489
|
+
- The date should include the time the food was consumed ("YYYY-MM-DD HH:mm:ss"); date only (YYYY-MM-DD) logs it at 00:00
|
|
30490
30490
|
- You can use serving or base unit approach:
|
|
30491
30491
|
1. serving type + serving quantity + amount (amount for selected serving type multiplied by serving quantity)
|
|
30492
30492
|
2. amount in g/ml - serving fields could be omitted
|
|
@@ -30760,11 +30760,12 @@ ${JSON.stringify(settings, null, 2)}`
|
|
|
30760
30760
|
async getUserSuggestedProducts(args) {
|
|
30761
30761
|
const client = await this.ensureAuthenticated();
|
|
30762
30762
|
try {
|
|
30763
|
+
const { limit, ...rest } = args;
|
|
30763
30764
|
const options = {
|
|
30764
30765
|
daytime: "breakfast",
|
|
30765
|
-
...
|
|
30766
|
+
...rest
|
|
30766
30767
|
};
|
|
30767
|
-
const suggestions = await client.user.getSuggestedProducts(options);
|
|
30768
|
+
const suggestions = (await client.user.getSuggestedProducts(options)).slice(0, limit);
|
|
30768
30769
|
return {
|
|
30769
30770
|
content: [
|
|
30770
30771
|
{
|
|
@@ -30782,10 +30783,23 @@ ${JSON.stringify(suggestions, null, 2)}`
|
|
|
30782
30783
|
async addUserConsumedItem(args) {
|
|
30783
30784
|
const client = await this.ensureAuthenticated();
|
|
30784
30785
|
try {
|
|
30785
|
-
await client.
|
|
30786
|
-
|
|
30787
|
-
|
|
30786
|
+
const token = await client.auth.authenticate();
|
|
30787
|
+
const response = await fetch("https://yzapi.yazio.com/v15/user/consumed-items", {
|
|
30788
|
+
method: "POST",
|
|
30789
|
+
headers: {
|
|
30790
|
+
"Content-Type": "application/json",
|
|
30791
|
+
"Authorization": `Bearer ${token.access_token}`
|
|
30792
|
+
},
|
|
30793
|
+
body: JSON.stringify({
|
|
30794
|
+
recipe_portions: [],
|
|
30795
|
+
simple_products: [],
|
|
30796
|
+
products: [{ ...args, id: v4_default() }]
|
|
30797
|
+
})
|
|
30788
30798
|
});
|
|
30799
|
+
if (!response.ok) {
|
|
30800
|
+
const errorText = await response.text();
|
|
30801
|
+
throw new Error(`${response.status} ${response.statusText} - ${errorText}`);
|
|
30802
|
+
}
|
|
30789
30803
|
return {
|
|
30790
30804
|
content: [
|
|
30791
30805
|
{
|
package/dist/schemas.d.ts
CHANGED
|
@@ -26,10 +26,6 @@ export declare const QueryInputSchema: z.ZodObject<{
|
|
|
26
26
|
countries: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
27
27
|
locales: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
28
28
|
}, z.core.$strip>;
|
|
29
|
-
export declare const OptionalQueryInputSchema: z.ZodObject<{
|
|
30
|
-
query: z.ZodOptional<z.ZodString>;
|
|
31
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
32
|
-
}, z.core.$strip>;
|
|
33
29
|
export declare const EmptyInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
34
30
|
export declare const GetFoodEntriesInputSchema: z.ZodObject<{
|
|
35
31
|
date: z.ZodISODate;
|
|
@@ -78,12 +74,18 @@ export declare const GetUserExercisesInputSchema: z.ZodObject<{
|
|
|
78
74
|
}, z.core.$strip>;
|
|
79
75
|
export declare const GetUserSettingsInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
80
76
|
export declare const GetUserSuggestedProductsInputSchema: z.ZodObject<{
|
|
81
|
-
|
|
77
|
+
date: z.ZodOptional<z.ZodISODate>;
|
|
78
|
+
daytime: z.ZodOptional<z.ZodEnum<{
|
|
79
|
+
breakfast: "breakfast";
|
|
80
|
+
lunch: "lunch";
|
|
81
|
+
dinner: "dinner";
|
|
82
|
+
snack: "snack";
|
|
83
|
+
}>>;
|
|
82
84
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
83
85
|
}, z.core.$strip>;
|
|
84
86
|
export declare const AddConsumedItemInputSchema: z.ZodObject<{
|
|
85
87
|
product_id: z.ZodUUID;
|
|
86
|
-
date: z.ZodISODate
|
|
88
|
+
date: z.ZodUnion<readonly [z.ZodISODate, z.ZodString]>;
|
|
87
89
|
daytime: z.ZodEnum<{
|
|
88
90
|
breakfast: "breakfast";
|
|
89
91
|
lunch: "lunch";
|