@daften/mealie-mcp 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +36 -0
- package/CHANGELOG.md +17 -0
- package/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/args.d.ts +14 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +132 -0
- package/dist/args.js.map +1 -0
- package/dist/auth/crypto.d.ts +9 -0
- package/dist/auth/crypto.d.ts.map +1 -0
- package/dist/auth/crypto.js +34 -0
- package/dist/auth/crypto.js.map +1 -0
- package/dist/auth/index.d.ts +15 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +77 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/login-method.d.ts +28 -0
- package/dist/auth/login-method.d.ts.map +1 -0
- package/dist/auth/login-method.js +2 -0
- package/dist/auth/login-method.js.map +1 -0
- package/dist/auth/mealie-session.d.ts +28 -0
- package/dist/auth/mealie-session.d.ts.map +1 -0
- package/dist/auth/mealie-session.js +81 -0
- package/dist/auth/mealie-session.js.map +1 -0
- package/dist/auth/password-login.d.ts +21 -0
- package/dist/auth/password-login.d.ts.map +1 -0
- package/dist/auth/password-login.js +168 -0
- package/dist/auth/password-login.js.map +1 -0
- package/dist/auth/provider.d.ts +41 -0
- package/dist/auth/provider.d.ts.map +1 -0
- package/dist/auth/provider.js +201 -0
- package/dist/auth/provider.js.map +1 -0
- package/dist/auth/redirects.d.ts +2 -0
- package/dist/auth/redirects.d.ts.map +1 -0
- package/dist/auth/redirects.js +71 -0
- package/dist/auth/redirects.js.map +1 -0
- package/dist/auth/store.d.ts +61 -0
- package/dist/auth/store.d.ts.map +1 -0
- package/dist/auth/store.js +201 -0
- package/dist/auth/store.js.map +1 -0
- package/dist/client.d.ts +39 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +180 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +16 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +82 -0
- package/dist/config.js.map +1 -0
- package/dist/http.d.ts +54 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +227 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +10 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/_annotations.d.ts +17 -0
- package/dist/tools/_annotations.d.ts.map +1 -0
- package/dist/tools/_annotations.js +9 -0
- package/dist/tools/_annotations.js.map +1 -0
- package/dist/tools/_helpers.d.ts +50 -0
- package/dist/tools/_helpers.d.ts.map +1 -0
- package/dist/tools/_helpers.js +67 -0
- package/dist/tools/_helpers.js.map +1 -0
- package/dist/tools/index.d.ts +18 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +53 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/ingredients.d.ts +4 -0
- package/dist/tools/ingredients.d.ts.map +1 -0
- package/dist/tools/ingredients.js +68 -0
- package/dist/tools/ingredients.js.map +1 -0
- package/dist/tools/mealplans.d.ts +4 -0
- package/dist/tools/mealplans.d.ts.map +1 -0
- package/dist/tools/mealplans.js +71 -0
- package/dist/tools/mealplans.js.map +1 -0
- package/dist/tools/organizers.d.ts +4 -0
- package/dist/tools/organizers.d.ts.map +1 -0
- package/dist/tools/organizers.js +49 -0
- package/dist/tools/organizers.js.map +1 -0
- package/dist/tools/recipe-assets.d.ts +4 -0
- package/dist/tools/recipe-assets.d.ts.map +1 -0
- package/dist/tools/recipe-assets.js +55 -0
- package/dist/tools/recipe-assets.js.map +1 -0
- package/dist/tools/recipes.d.ts +89 -0
- package/dist/tools/recipes.d.ts.map +1 -0
- package/dist/tools/recipes.js +206 -0
- package/dist/tools/recipes.js.map +1 -0
- package/dist/tools/shopping.d.ts +4 -0
- package/dist/tools/shopping.d.ts.map +1 -0
- package/dist/tools/shopping.js +94 -0
- package/dist/tools/shopping.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DELETE_ANNOTATIONS, READ_ANNOTATIONS, UPDATE_ANNOTATIONS, WRITE_ANNOTATIONS } from './_annotations.js';
|
|
3
|
+
import { defined, defineTool, idSchema, mergePut, paginationQuery, paginationShape, shapePage, } from './_helpers.js';
|
|
4
|
+
export function registerIngredientTools(server, client) {
|
|
5
|
+
defineTool(server, 'parse_ingredients', {
|
|
6
|
+
title: 'Parse ingredients',
|
|
7
|
+
description: "Uses Mealie's parser to split free-text ingredient lines into quantity, unit and food.",
|
|
8
|
+
inputSchema: {
|
|
9
|
+
ingredients: z.array(z.string().min(1)).min(1),
|
|
10
|
+
parser: z.enum(['nlp', 'brute', 'openai']).optional().describe('nlp by default'),
|
|
11
|
+
},
|
|
12
|
+
annotations: { ...READ_ANNOTATIONS, idempotentHint: true },
|
|
13
|
+
}, ({ ingredients, parser }) => client.post('/parser/ingredients', { ingredients, parser: parser ?? 'nlp' }));
|
|
14
|
+
for (const kind of [
|
|
15
|
+
{ singular: 'food', plural: 'foods', path: '/foods' },
|
|
16
|
+
{ singular: 'unit', plural: 'units', path: '/units' },
|
|
17
|
+
]) {
|
|
18
|
+
defineTool(server, `list_${kind.plural}`, {
|
|
19
|
+
title: `List ${kind.plural}`,
|
|
20
|
+
description: `Lists or searches ${kind.plural} in Mealie's shared vocabulary.`,
|
|
21
|
+
inputSchema: { search: z.string().optional(), ...paginationShape },
|
|
22
|
+
annotations: READ_ANNOTATIONS,
|
|
23
|
+
}, async (args) => shapePage(await client.get(kind.path, { ...paginationQuery(args), search: args.search })));
|
|
24
|
+
defineTool(server, `create_${kind.singular}`, {
|
|
25
|
+
title: `Create ${kind.singular}`,
|
|
26
|
+
description: `Adds a ${kind.singular} to Mealie's shared vocabulary.`,
|
|
27
|
+
inputSchema: {
|
|
28
|
+
name: z.string().min(1),
|
|
29
|
+
plural_name: z.string().optional(),
|
|
30
|
+
description: z.string().optional(),
|
|
31
|
+
...(kind.singular === 'unit' ? { abbreviation: z.string().optional() } : {}),
|
|
32
|
+
},
|
|
33
|
+
annotations: WRITE_ANNOTATIONS,
|
|
34
|
+
}, (args) => client.post(kind.path, defined({
|
|
35
|
+
name: args.name,
|
|
36
|
+
pluralName: args.plural_name,
|
|
37
|
+
description: args.description,
|
|
38
|
+
abbreviation: args.abbreviation,
|
|
39
|
+
})));
|
|
40
|
+
defineTool(server, `update_${kind.singular}`, {
|
|
41
|
+
title: `Update ${kind.singular}`,
|
|
42
|
+
description: `Changes the given fields of a ${kind.singular}.`,
|
|
43
|
+
inputSchema: {
|
|
44
|
+
id: idSchema,
|
|
45
|
+
name: z.string().min(1).optional(),
|
|
46
|
+
plural_name: z.string().optional(),
|
|
47
|
+
description: z.string().optional(),
|
|
48
|
+
...(kind.singular === 'unit' ? { abbreviation: z.string().optional() } : {}),
|
|
49
|
+
},
|
|
50
|
+
annotations: UPDATE_ANNOTATIONS,
|
|
51
|
+
}, ({ id, ...args }) => mergePut(client, `${kind.path}/${id}`, {
|
|
52
|
+
name: args.name,
|
|
53
|
+
pluralName: args.plural_name,
|
|
54
|
+
description: args.description,
|
|
55
|
+
abbreviation: args.abbreviation,
|
|
56
|
+
}));
|
|
57
|
+
defineTool(server, `delete_${kind.singular}`, {
|
|
58
|
+
title: `Delete ${kind.singular}`,
|
|
59
|
+
description: `Permanently deletes a ${kind.singular}. Ingredients using it lose the link.`,
|
|
60
|
+
inputSchema: { id: idSchema },
|
|
61
|
+
annotations: DELETE_ANNOTATIONS,
|
|
62
|
+
}, async ({ id }) => {
|
|
63
|
+
await client.delete(`${kind.path}/${id}`);
|
|
64
|
+
return { deleted: true, id };
|
|
65
|
+
});
|
|
66
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EAAE,EACzB;YACE,KAAK,EAAE,UAAU,IAAI,CAAC,QAAQ,EAAE;YAChC,WAAW,EAAE,yBAAyB,IAAI,CAAC,QAAQ,uCAAuC;YAC1F,WAAW,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE;YAC7B,WAAW,EAAE,kBAAkB;SAChC,EACD,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;YACf,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;YAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC/B,CAAC,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mealplans.d.ts","sourceRoot":"","sources":["../../src/tools/mealplans.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkBjD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA0GnF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DELETE_ANNOTATIONS, READ_ANNOTATIONS, UPDATE_ANNOTATIONS, WRITE_ANNOTATIONS } from './_annotations.js';
|
|
3
|
+
import { dateSchema, defined, defineTool, idSchema, mergePut, paginationQuery, paginationShape, shapePage, } from './_helpers.js';
|
|
4
|
+
const PLANS = '/households/mealplans';
|
|
5
|
+
const entryType = z.enum(['breakfast', 'lunch', 'dinner', 'side', 'snack', 'drink', 'dessert']);
|
|
6
|
+
const entryId = z.number().int().positive();
|
|
7
|
+
export function registerMealplanTools(server, client) {
|
|
8
|
+
defineTool(server, 'get_mealplans', {
|
|
9
|
+
title: 'Get meal plans',
|
|
10
|
+
description: 'Lists meal plan entries for the household, optionally within a date range.',
|
|
11
|
+
inputSchema: { start_date: dateSchema.optional(), end_date: dateSchema.optional(), ...paginationShape },
|
|
12
|
+
annotations: READ_ANNOTATIONS,
|
|
13
|
+
}, async (args) => shapePage(await client.get(PLANS, {
|
|
14
|
+
...paginationQuery(args),
|
|
15
|
+
start_date: args.start_date,
|
|
16
|
+
end_date: args.end_date,
|
|
17
|
+
})));
|
|
18
|
+
defineTool(server, 'get_todays_meals', {
|
|
19
|
+
title: "Get today's meals",
|
|
20
|
+
description: "Gets today's meal plan entries.",
|
|
21
|
+
inputSchema: {},
|
|
22
|
+
annotations: READ_ANNOTATIONS,
|
|
23
|
+
}, () => client.get(`${PLANS}/today`));
|
|
24
|
+
defineTool(server, 'create_mealplan_entry', {
|
|
25
|
+
title: 'Create meal plan entry',
|
|
26
|
+
description: 'Adds a meal to the plan: either a recipe, or a title and note for something without one.',
|
|
27
|
+
inputSchema: {
|
|
28
|
+
date: dateSchema,
|
|
29
|
+
entry_type: entryType.optional().describe('dinner by default'),
|
|
30
|
+
recipe_id: idSchema.optional().describe('The recipe id, not its slug'),
|
|
31
|
+
title: z.string().optional(),
|
|
32
|
+
text: z.string().optional(),
|
|
33
|
+
},
|
|
34
|
+
annotations: WRITE_ANNOTATIONS,
|
|
35
|
+
}, (args) => client.post(PLANS, defined({
|
|
36
|
+
date: args.date,
|
|
37
|
+
entryType: args.entry_type ?? 'dinner',
|
|
38
|
+
recipeId: args.recipe_id,
|
|
39
|
+
title: args.title,
|
|
40
|
+
text: args.text,
|
|
41
|
+
})));
|
|
42
|
+
defineTool(server, 'create_random_mealplan_entry', {
|
|
43
|
+
title: 'Create random meal plan entry',
|
|
44
|
+
description: "Lets Mealie pick a recipe for a date, following the household's meal plan rules.",
|
|
45
|
+
inputSchema: { date: dateSchema, entry_type: entryType.optional().describe('dinner by default') },
|
|
46
|
+
annotations: WRITE_ANNOTATIONS,
|
|
47
|
+
}, ({ date, entry_type }) => client.post(`${PLANS}/random`, { date, entryType: entry_type ?? 'dinner' }));
|
|
48
|
+
defineTool(server, 'update_mealplan_entry', {
|
|
49
|
+
title: 'Update meal plan entry',
|
|
50
|
+
description: 'Changes the given fields of a meal plan entry.',
|
|
51
|
+
inputSchema: {
|
|
52
|
+
id: entryId,
|
|
53
|
+
date: dateSchema.optional(),
|
|
54
|
+
entry_type: entryType.optional(),
|
|
55
|
+
recipe_id: idSchema.optional(),
|
|
56
|
+
title: z.string().optional(),
|
|
57
|
+
text: z.string().optional(),
|
|
58
|
+
},
|
|
59
|
+
annotations: UPDATE_ANNOTATIONS,
|
|
60
|
+
}, ({ id, entry_type, recipe_id, ...rest }) => mergePut(client, `${PLANS}/${id}`, { ...rest, entryType: entry_type, recipeId: recipe_id }));
|
|
61
|
+
defineTool(server, 'delete_mealplan_entry', {
|
|
62
|
+
title: 'Delete meal plan entry',
|
|
63
|
+
description: 'Removes an entry from the meal plan.',
|
|
64
|
+
inputSchema: { id: entryId },
|
|
65
|
+
annotations: DELETE_ANNOTATIONS,
|
|
66
|
+
}, async ({ id }) => {
|
|
67
|
+
await client.delete(`${PLANS}/${id}`);
|
|
68
|
+
return { deleted: true, id };
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=mealplans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mealplans.js","sourceRoot":"","sources":["../../src/tools/mealplans.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChH,OAAO,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,QAAQ,EACR,QAAQ,EAER,eAAe,EACf,eAAe,EACf,SAAS,GACV,MAAM,eAAe,CAAC;AAEvB,MAAM,KAAK,GAAG,uBAAuB,CAAC;AACtC,MAAM,SAAS,GAAG,CAAC,CA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EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC5B;QACD,WAAW,EAAE,kBAAkB;KAChC,EACD,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CACzC,QAAQ,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAC9F,CAAC;IAEF,UAAU,CACR,MAAM,EACN,uBAAuB,EACvB;QACE,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,sCAAsC;QACnD,WAAW,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;QAC5B,WAAW,EAAE,kBAAkB;KAChC,EACD,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;QACf,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;QACtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC/B,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organizers.d.ts","sourceRoot":"","sources":["../../src/tools/organizers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAmBjD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAqEpF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DELETE_ANNOTATIONS, READ_ANNOTATIONS, UPDATE_ANNOTATIONS, WRITE_ANNOTATIONS } from './_annotations.js';
|
|
3
|
+
import { defineTool, idSchema, mergePut, paginationQuery, paginationShape, shapePage, } from './_helpers.js';
|
|
4
|
+
const KINDS = [
|
|
5
|
+
{ singular: 'category', plural: 'categories', path: '/organizers/categories' },
|
|
6
|
+
{ singular: 'tag', plural: 'tags', path: '/organizers/tags' },
|
|
7
|
+
// "tool" alone would read as an MCP tool in a tool list.
|
|
8
|
+
{ singular: 'recipe_tool', plural: 'recipe_tools', path: '/organizers/tools' },
|
|
9
|
+
];
|
|
10
|
+
export function registerOrganizerTools(server, client) {
|
|
11
|
+
for (const kind of KINDS) {
|
|
12
|
+
const label = kind.plural.replace('_', ' ');
|
|
13
|
+
const one = kind.singular.replace('_', ' ');
|
|
14
|
+
defineTool(server, `list_${kind.plural}`, {
|
|
15
|
+
title: `List ${label}`,
|
|
16
|
+
description: `Lists or searches ${label}.`,
|
|
17
|
+
inputSchema: { search: z.string().optional(), ...paginationShape },
|
|
18
|
+
annotations: READ_ANNOTATIONS,
|
|
19
|
+
}, async (args) => shapePage(await client.get(kind.path, { ...paginationQuery(args), search: args.search })));
|
|
20
|
+
defineTool(server, `list_unused_${kind.plural}`, {
|
|
21
|
+
title: `List unused ${label}`,
|
|
22
|
+
description: `Lists ${label} that no recipe uses.`,
|
|
23
|
+
inputSchema: {},
|
|
24
|
+
annotations: READ_ANNOTATIONS,
|
|
25
|
+
}, () => client.get(`${kind.path}/empty`));
|
|
26
|
+
defineTool(server, `create_${kind.singular}`, {
|
|
27
|
+
title: `Create ${one}`,
|
|
28
|
+
description: `Creates a ${one}.`,
|
|
29
|
+
inputSchema: { name: z.string().min(1) },
|
|
30
|
+
annotations: WRITE_ANNOTATIONS,
|
|
31
|
+
}, ({ name }) => client.post(kind.path, { name }));
|
|
32
|
+
defineTool(server, `rename_${kind.singular}`, {
|
|
33
|
+
title: `Rename ${one}`,
|
|
34
|
+
description: `Renames a ${one}.`,
|
|
35
|
+
inputSchema: { id: idSchema, name: z.string().min(1) },
|
|
36
|
+
annotations: UPDATE_ANNOTATIONS,
|
|
37
|
+
}, ({ id, name }) => mergePut(client, `${kind.path}/${id}`, { name }));
|
|
38
|
+
defineTool(server, `delete_${kind.singular}`, {
|
|
39
|
+
title: `Delete ${one}`,
|
|
40
|
+
description: `Permanently deletes a ${one} and removes it from every recipe.`,
|
|
41
|
+
inputSchema: { id: idSchema },
|
|
42
|
+
annotations: DELETE_ANNOTATIONS,
|
|
43
|
+
}, async ({ id }) => {
|
|
44
|
+
await client.delete(`${kind.path}/${id}`);
|
|
45
|
+
return { deleted: true, id };
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=organizers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organizers.js","sourceRoot":"","sources":["../../src/tools/organizers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChH,OAAO,EACL,UAAU,EACV,QAAQ,EACR,QAAQ,EAER,eAAe,EACf,eAAe,EACf,SAAS,GACV,MAAM,eAAe,CAAC;AAEvB,MAAM,KAAK,GAAG;IACZ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,wBAAwB,EAAE;IAC9E,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC7D,yDAAyD;IACzD,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,mBAAmB,EAAE;CAC/E,CAAC;AAEF,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,MAAoB;IAC5E,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,I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Y,EAAE,MAAM,cAAc,CAAC;AAMjD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAwEtF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DELETE_ANNOTATIONS, WRITE_ANNOTATIONS } from './_annotations.js';
|
|
3
|
+
import { decodeBase64, defineTool, slugSchema } from './_helpers.js';
|
|
4
|
+
const extension = z.string().regex(/^[A-Za-z0-9]{1,10}$/, 'File extension without the dot, e.g. jpg');
|
|
5
|
+
export function registerRecipeAssetTools(server, client) {
|
|
6
|
+
defineTool(server, 'set_recipe_image_from_url', {
|
|
7
|
+
title: 'Set recipe image from URL',
|
|
8
|
+
description: 'Has Mealie download an image and use it as the recipe image.',
|
|
9
|
+
inputSchema: { slug: slugSchema, url: z.url() },
|
|
10
|
+
annotations: WRITE_ANNOTATIONS,
|
|
11
|
+
}, async ({ slug, url }) => {
|
|
12
|
+
await client.post(`/recipes/${slug}/image`, { url });
|
|
13
|
+
return { updated: true, slug };
|
|
14
|
+
});
|
|
15
|
+
defineTool(server, 'upload_recipe_image', {
|
|
16
|
+
title: 'Upload recipe image',
|
|
17
|
+
description: 'Replaces the recipe image with an uploaded file, up to about 12 MB.',
|
|
18
|
+
inputSchema: { slug: slugSchema, image_base64: z.string().min(1), extension },
|
|
19
|
+
annotations: WRITE_ANNOTATIONS,
|
|
20
|
+
}, async ({ slug, image_base64, extension: ext }) => {
|
|
21
|
+
const form = new FormData();
|
|
22
|
+
form.set('image', new Blob([decodeBase64(image_base64, 'image_base64')]), `image.${ext}`);
|
|
23
|
+
form.set('extension', ext);
|
|
24
|
+
return client.sendForm('PUT', `/recipes/${slug}/image`, form);
|
|
25
|
+
});
|
|
26
|
+
defineTool(server, 'delete_recipe_image', {
|
|
27
|
+
title: 'Delete recipe image',
|
|
28
|
+
description: 'Removes the image from a recipe.',
|
|
29
|
+
inputSchema: { slug: slugSchema },
|
|
30
|
+
annotations: DELETE_ANNOTATIONS,
|
|
31
|
+
}, async ({ slug }) => {
|
|
32
|
+
await client.delete(`/recipes/${slug}/image`);
|
|
33
|
+
return { deleted: true, slug };
|
|
34
|
+
});
|
|
35
|
+
defineTool(server, 'upload_recipe_asset', {
|
|
36
|
+
title: 'Upload recipe asset',
|
|
37
|
+
description: 'Attaches a file, such as a PDF of the original recipe, up to about 12 MB.',
|
|
38
|
+
inputSchema: {
|
|
39
|
+
slug: slugSchema,
|
|
40
|
+
name: z.string().min(1).describe('Display name'),
|
|
41
|
+
icon: z.string().optional().describe('Material Design icon name, mdi-file by default'),
|
|
42
|
+
extension,
|
|
43
|
+
file_base64: z.string().min(1),
|
|
44
|
+
},
|
|
45
|
+
annotations: WRITE_ANNOTATIONS,
|
|
46
|
+
}, async ({ slug, name, icon, extension: ext, file_base64 }) => {
|
|
47
|
+
const form = new FormData();
|
|
48
|
+
form.set('name', name);
|
|
49
|
+
form.set('icon', icon ?? 'mdi-file');
|
|
50
|
+
form.set('extension', ext);
|
|
51
|
+
form.set('file', new Blob([decodeBase64(file_base64, 'file_base64')]), `${name}.${ext}`);
|
|
52
|
+
return client.sendForm('POST', `/recipes/${slug}/assets`, form);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=recipe-assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe-assets.js","sourceRoot":"","sources":["../../src/tools/recipe-assets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAErE,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,qBAAqB,EAAE,0CAA0C,CAAC,CAAC;AAEtG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AAI,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC;QACzF,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,IAAI,SAAS,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { MealieClient } from '../client.js';
|
|
4
|
+
type RecipeSummary = Record<string, unknown> & {
|
|
5
|
+
tags?: Array<{
|
|
6
|
+
name: string;
|
|
7
|
+
}> | null;
|
|
8
|
+
recipeCategory?: Array<{
|
|
9
|
+
name: string;
|
|
10
|
+
}> | null;
|
|
11
|
+
tools?: Array<{
|
|
12
|
+
name: string;
|
|
13
|
+
}> | null;
|
|
14
|
+
};
|
|
15
|
+
/** Search results carry whole summaries; these are the fields worth the tokens when choosing a recipe. */
|
|
16
|
+
export declare function summarizeRecipe(recipe: RecipeSummary): {
|
|
17
|
+
id: unknown;
|
|
18
|
+
slug: unknown;
|
|
19
|
+
name: unknown;
|
|
20
|
+
description: unknown;
|
|
21
|
+
rating: unknown;
|
|
22
|
+
servings: unknown;
|
|
23
|
+
total_time: unknown;
|
|
24
|
+
last_made: unknown;
|
|
25
|
+
categories: string[];
|
|
26
|
+
tags: string[];
|
|
27
|
+
tools: string[];
|
|
28
|
+
};
|
|
29
|
+
declare const recipeFields: {
|
|
30
|
+
description: z.ZodOptional<z.ZodString>;
|
|
31
|
+
recipe_servings: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
recipe_yield: z.ZodOptional<z.ZodString>;
|
|
33
|
+
total_time: z.ZodOptional<z.ZodString>;
|
|
34
|
+
prep_time: z.ZodOptional<z.ZodString>;
|
|
35
|
+
cook_time: z.ZodOptional<z.ZodString>;
|
|
36
|
+
org_url: z.ZodOptional<z.ZodURL>;
|
|
37
|
+
ingredients: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
38
|
+
note: z.ZodOptional<z.ZodString>;
|
|
39
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
unit: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
41
|
+
id: z.ZodUUID;
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
}, z.core.$loose>>>;
|
|
44
|
+
food: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
45
|
+
id: z.ZodUUID;
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
}, z.core.$loose>>>;
|
|
48
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
originalText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
}, z.core.$loose>>>;
|
|
51
|
+
instructions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
52
|
+
title: z.ZodOptional<z.ZodString>;
|
|
53
|
+
text: z.ZodString;
|
|
54
|
+
}, z.core.$loose>>>;
|
|
55
|
+
notes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
56
|
+
title: z.ZodString;
|
|
57
|
+
text: z.ZodString;
|
|
58
|
+
}, z.core.$strip>>>;
|
|
59
|
+
nutrition: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
60
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
61
|
+
id: z.ZodUUID;
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
slug: z.ZodString;
|
|
64
|
+
}, z.core.$loose>>>;
|
|
65
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
66
|
+
id: z.ZodUUID;
|
|
67
|
+
name: z.ZodString;
|
|
68
|
+
slug: z.ZodString;
|
|
69
|
+
}, z.core.$loose>>>;
|
|
70
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
71
|
+
id: z.ZodUUID;
|
|
72
|
+
name: z.ZodString;
|
|
73
|
+
slug: z.ZodString;
|
|
74
|
+
}, z.core.$loose>>>;
|
|
75
|
+
settings: z.ZodOptional<z.ZodObject<{
|
|
76
|
+
public: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
showNutrition: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
showAssets: z.ZodOptional<z.ZodBoolean>;
|
|
79
|
+
}, z.core.$loose>>;
|
|
80
|
+
};
|
|
81
|
+
type RecipeFieldArgs = {
|
|
82
|
+
[K in keyof typeof recipeFields]?: z.infer<(typeof recipeFields)[K]>;
|
|
83
|
+
};
|
|
84
|
+
export declare function toRecipePatch(args: RecipeFieldArgs & {
|
|
85
|
+
name?: string;
|
|
86
|
+
}): Record<string, unknown>;
|
|
87
|
+
export declare function registerRecipeTools(server: McpServer, client: MealieClient): void;
|
|
88
|
+
export {};
|
|
89
|
+
//# sourceMappingURL=recipes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipes.d.ts","sourceRoot":"","sources":["../../src/tools/recipes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAYjD,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAC7C,IAAI,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IACtC,cAAc,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IAChD,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;CACxC,CAAC;AAEF,0GAA0G;AAC1G,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa;IAEjD,EAAE;IACF,IAAI;IACJ,IAAI;IACJ,WAAW;IACX,MAAM;IACN,QAAQ;IACR,UAAU;IACV,SAAS;IACT,UAAU;IACV,IAAI;IACJ,KAAK;EAER;AAkBD,QAAA,MAAM,YAAY;IAChB,WAAW;IACX,eAAe;IACf,YAAY;IACZ,UAAU;IACV,SAAS;IACT,SAAS;IACT,OAAO;IACP,WAAW;;;;;;;;;;;;;;IACX,YAAY;;;;IACZ,KAAK;;;;IAIL,SAAS;IAIT,UAAU;;;;;IACV,IAAI;;;;;IACJ,KAAK;;;;;IACL,QAAQ;;;;;CAOT,CAAC;AAEF,KAAK,eAAe,GAAG;KACpB,CAAC,IAAI,MAAM,OAAO,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CACrE,CAAC;AAEF,wBAAgB,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmBhG;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CA0LjF"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DELETE_ANNOTATIONS, READ_ANNOTATIONS, UPDATE_ANNOTATIONS, WRITE_ANNOTATIONS } from './_annotations.js';
|
|
3
|
+
import { defined, defineTool, paginationQuery, paginationShape, shapePage, slugSchema, } from './_helpers.js';
|
|
4
|
+
/** Search results carry whole summaries; these are the fields worth the tokens when choosing a recipe. */
|
|
5
|
+
export function summarizeRecipe(recipe) {
|
|
6
|
+
return {
|
|
7
|
+
id: recipe.id,
|
|
8
|
+
slug: recipe.slug,
|
|
9
|
+
name: recipe.name,
|
|
10
|
+
description: recipe.description,
|
|
11
|
+
rating: recipe.rating,
|
|
12
|
+
servings: recipe.recipeServings,
|
|
13
|
+
total_time: recipe.totalTime,
|
|
14
|
+
last_made: recipe.lastMade,
|
|
15
|
+
categories: recipe.recipeCategory?.map((c) => c.name) ?? [],
|
|
16
|
+
tags: recipe.tags?.map((t) => t.name) ?? [],
|
|
17
|
+
tools: recipe.tools?.map((t) => t.name) ?? [],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const organizerRef = z.looseObject({ id: z.uuid(), name: z.string(), slug: z.string() });
|
|
21
|
+
const ingredient = z.looseObject({
|
|
22
|
+
note: z
|
|
23
|
+
.string()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe('Free text. Use this alone when the ingredient is not parsed into food and unit'),
|
|
26
|
+
quantity: z.number().optional(),
|
|
27
|
+
unit: z.looseObject({ id: z.uuid(), name: z.string() }).nullable().optional(),
|
|
28
|
+
food: z.looseObject({ id: z.uuid(), name: z.string() }).nullable().optional(),
|
|
29
|
+
title: z.string().nullable().optional().describe('Section heading shown above this ingredient'),
|
|
30
|
+
originalText: z.string().nullable().optional(),
|
|
31
|
+
});
|
|
32
|
+
const step = z.looseObject({ title: z.string().optional(), text: z.string() });
|
|
33
|
+
const recipeFields = {
|
|
34
|
+
description: z.string().optional(),
|
|
35
|
+
recipe_servings: z.number().optional(),
|
|
36
|
+
recipe_yield: z.string().optional().describe('Yield as free text, e.g. "2 loaves"'),
|
|
37
|
+
total_time: z.string().optional().describe('Free text, e.g. "1 hour 30 minutes"'),
|
|
38
|
+
prep_time: z.string().optional(),
|
|
39
|
+
cook_time: z.string().optional(),
|
|
40
|
+
org_url: z.url().optional().describe('Original source URL'),
|
|
41
|
+
ingredients: z.array(ingredient).optional().describe('Replaces the whole ingredient list'),
|
|
42
|
+
instructions: z.array(step).optional().describe('Replaces all instruction steps'),
|
|
43
|
+
notes: z
|
|
44
|
+
.array(z.object({ title: z.string(), text: z.string() }))
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('Replaces all notes'),
|
|
47
|
+
nutrition: z
|
|
48
|
+
.record(z.string(), z.string().nullable())
|
|
49
|
+
.optional()
|
|
50
|
+
.describe('e.g. {"calories": "250", "proteinContent": "12"}'),
|
|
51
|
+
categories: z.array(organizerRef).optional().describe('Full objects from list_categories. Replaces all categories'),
|
|
52
|
+
tags: z.array(organizerRef).optional().describe('Full objects from list_tags. Replaces all tags'),
|
|
53
|
+
tools: z.array(organizerRef).optional().describe('Full objects from list_recipe_tools. Replaces all tools'),
|
|
54
|
+
settings: z
|
|
55
|
+
.looseObject({
|
|
56
|
+
public: z.boolean().optional(),
|
|
57
|
+
showNutrition: z.boolean().optional(),
|
|
58
|
+
showAssets: z.boolean().optional(),
|
|
59
|
+
})
|
|
60
|
+
.optional(),
|
|
61
|
+
};
|
|
62
|
+
export function toRecipePatch(args) {
|
|
63
|
+
return defined({
|
|
64
|
+
name: args.name,
|
|
65
|
+
description: args.description,
|
|
66
|
+
recipeServings: args.recipe_servings,
|
|
67
|
+
recipeYield: args.recipe_yield,
|
|
68
|
+
totalTime: args.total_time,
|
|
69
|
+
prepTime: args.prep_time,
|
|
70
|
+
cookTime: args.cook_time,
|
|
71
|
+
orgURL: args.org_url,
|
|
72
|
+
recipeIngredient: args.ingredients,
|
|
73
|
+
recipeInstructions: args.instructions,
|
|
74
|
+
notes: args.notes,
|
|
75
|
+
nutrition: args.nutrition,
|
|
76
|
+
recipeCategory: args.categories,
|
|
77
|
+
tags: args.tags,
|
|
78
|
+
tools: args.tools,
|
|
79
|
+
settings: args.settings,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export function registerRecipeTools(server, client) {
|
|
83
|
+
defineTool(server, 'get_current_user', {
|
|
84
|
+
title: 'Get current user',
|
|
85
|
+
description: 'Shows which Mealie account this connection acts as, with its group and household.',
|
|
86
|
+
inputSchema: {},
|
|
87
|
+
annotations: READ_ANNOTATIONS,
|
|
88
|
+
}, async () => {
|
|
89
|
+
const user = await client.get('/users/self');
|
|
90
|
+
return {
|
|
91
|
+
id: user.id,
|
|
92
|
+
username: user.username,
|
|
93
|
+
full_name: user.fullName,
|
|
94
|
+
email: user.email,
|
|
95
|
+
admin: user.admin,
|
|
96
|
+
group: user.group,
|
|
97
|
+
household: user.household,
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
defineTool(server, 'search_recipes', {
|
|
101
|
+
title: 'Search recipes',
|
|
102
|
+
description: 'Searches recipes by text and by category, tag, tool or food IDs. Returns summaries; use get_recipe for full details.',
|
|
103
|
+
inputSchema: {
|
|
104
|
+
search: z.string().optional().describe('Free text search'),
|
|
105
|
+
categories: z.array(z.string()).optional().describe('Category IDs or slugs'),
|
|
106
|
+
tags: z.array(z.string()).optional().describe('Tag IDs or slugs'),
|
|
107
|
+
tools: z.array(z.string()).optional().describe('Tool IDs or slugs'),
|
|
108
|
+
foods: z.array(z.string()).optional().describe('Food IDs or slugs'),
|
|
109
|
+
require_all: z.boolean().optional().describe('Require every given filter value instead of any one'),
|
|
110
|
+
order_by: z.string().optional().describe('Field such as name, rating, created_at or last_made'),
|
|
111
|
+
order_direction: z.enum(['asc', 'desc']).optional(),
|
|
112
|
+
...paginationShape,
|
|
113
|
+
},
|
|
114
|
+
annotations: READ_ANNOTATIONS,
|
|
115
|
+
}, async (args) => {
|
|
116
|
+
const response = await client.get('/recipes', {
|
|
117
|
+
...paginationQuery(args),
|
|
118
|
+
search: args.search,
|
|
119
|
+
categories: args.categories,
|
|
120
|
+
tags: args.tags,
|
|
121
|
+
tools: args.tools,
|
|
122
|
+
foods: args.foods,
|
|
123
|
+
requireAllCategories: args.require_all,
|
|
124
|
+
requireAllTags: args.require_all,
|
|
125
|
+
requireAllTools: args.require_all,
|
|
126
|
+
requireAllFoods: args.require_all,
|
|
127
|
+
orderBy: args.order_by,
|
|
128
|
+
orderDirection: args.order_direction,
|
|
129
|
+
});
|
|
130
|
+
return shapePage(response, summarizeRecipe);
|
|
131
|
+
});
|
|
132
|
+
defineTool(server, 'get_recipe', {
|
|
133
|
+
title: 'Get recipe',
|
|
134
|
+
description: 'Gets one recipe in full, including ingredients, instructions and nutrition.',
|
|
135
|
+
inputSchema: { slug: slugSchema },
|
|
136
|
+
annotations: READ_ANNOTATIONS,
|
|
137
|
+
}, ({ slug }) => client.get(`/recipes/${slug}`));
|
|
138
|
+
defineTool(server, 'create_recipe', {
|
|
139
|
+
title: 'Create recipe',
|
|
140
|
+
description: 'Creates a recipe from structured data. To import from a web page, use import_recipe_from_url.',
|
|
141
|
+
inputSchema: { name: z.string().min(1), ...recipeFields },
|
|
142
|
+
annotations: WRITE_ANNOTATIONS,
|
|
143
|
+
}, async (args) => {
|
|
144
|
+
const slug = await client.post('/recipes', { name: args.name });
|
|
145
|
+
const { name: _name, ...fields } = toRecipePatch(args);
|
|
146
|
+
if (Object.keys(fields).length === 0)
|
|
147
|
+
return { slug };
|
|
148
|
+
return client.patch(`/recipes/${slug}`, fields);
|
|
149
|
+
});
|
|
150
|
+
defineTool(server, 'import_recipe_from_url', {
|
|
151
|
+
title: 'Import recipe from URL',
|
|
152
|
+
description: 'Has Mealie scrape a recipe web page and create a recipe from it. Returns the new slug.',
|
|
153
|
+
inputSchema: {
|
|
154
|
+
url: z.url(),
|
|
155
|
+
include_tags: z.boolean().optional().describe('Also import tags found on the page'),
|
|
156
|
+
include_categories: z.boolean().optional().describe('Also import categories found on the page'),
|
|
157
|
+
},
|
|
158
|
+
annotations: WRITE_ANNOTATIONS,
|
|
159
|
+
}, async (args) => ({
|
|
160
|
+
slug: await client.post('/recipes/create/url', defined({ url: args.url, includeTags: args.include_tags, includeCategories: args.include_categories })),
|
|
161
|
+
}));
|
|
162
|
+
defineTool(server, 'update_recipe', {
|
|
163
|
+
title: 'Update recipe',
|
|
164
|
+
description: 'Changes the given fields of a recipe and leaves the rest alone. List fields are replaced as a whole.',
|
|
165
|
+
inputSchema: { slug: slugSchema, name: z.string().min(1).optional(), ...recipeFields },
|
|
166
|
+
annotations: UPDATE_ANNOTATIONS,
|
|
167
|
+
}, ({ slug, ...fields }) => client.patch(`/recipes/${slug}`, toRecipePatch(fields)));
|
|
168
|
+
defineTool(server, 'duplicate_recipe', {
|
|
169
|
+
title: 'Duplicate recipe',
|
|
170
|
+
description: 'Copies a recipe, optionally under a new name.',
|
|
171
|
+
inputSchema: { slug: slugSchema, name: z.string().optional() },
|
|
172
|
+
annotations: WRITE_ANNOTATIONS,
|
|
173
|
+
}, ({ slug, name }) => client.post(`/recipes/${slug}/duplicate`, defined({ name })));
|
|
174
|
+
defineTool(server, 'mark_recipe_made', {
|
|
175
|
+
title: 'Mark recipe made',
|
|
176
|
+
description: 'Records that a recipe was made, today by default.',
|
|
177
|
+
inputSchema: { slug: slugSchema, timestamp: z.iso.datetime({ offset: true }).optional() },
|
|
178
|
+
annotations: UPDATE_ANNOTATIONS,
|
|
179
|
+
}, ({ slug, timestamp }) => client.patch(`/recipes/${slug}/last-made`, { timestamp: timestamp ?? new Date().toISOString() }));
|
|
180
|
+
defineTool(server, 'rate_recipe', {
|
|
181
|
+
title: 'Rate recipe',
|
|
182
|
+
description: "Sets the current user's own rating for a recipe, or marks it as a favorite.",
|
|
183
|
+
inputSchema: {
|
|
184
|
+
slug: slugSchema,
|
|
185
|
+
rating: z.number().min(0).max(5).optional(),
|
|
186
|
+
is_favorite: z.boolean().optional(),
|
|
187
|
+
},
|
|
188
|
+
annotations: UPDATE_ANNOTATIONS,
|
|
189
|
+
},
|
|
190
|
+
// Ratings are per user: a `rating` sent with the recipe itself is silently ignored.
|
|
191
|
+
async ({ slug, rating, is_favorite }) => {
|
|
192
|
+
const user = await client.get('/users/self');
|
|
193
|
+
await client.post(`/users/${user.id}/ratings/${slug}`, defined({ rating, isFavorite: is_favorite }));
|
|
194
|
+
return { updated: true, slug, rating, is_favorite };
|
|
195
|
+
});
|
|
196
|
+
defineTool(server, 'delete_recipe', {
|
|
197
|
+
title: 'Delete recipe',
|
|
198
|
+
description: 'Permanently deletes a recipe.',
|
|
199
|
+
inputSchema: { slug: slugSchema },
|
|
200
|
+
annotations: DELETE_ANNOTATIONS,
|
|
201
|
+
}, async ({ slug }) => {
|
|
202
|
+
await client.delete(`/recipes/${slug}`);
|
|
203
|
+
return { deleted: true, slug };
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=recipes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipes.js","sourceRoot":"","sources":["../../src/tools/recipes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChH,OAAO,EACL,OAAO,EACP,UAAU,EAEV,eAAe,EACf,eAAe,EACf,SAAS,EACT,UAAU,GACX,MAAM,eAAe,CAAC;AAQvB,0GAA0G;AAC1G,MAAM,UAAU,eAAe,CAAC,MAAqB;IACnD,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,QAAQ,EAAE,MAAM,CAAC,cAAc;QAC/B,UAAU,EAAE,MAAM,CAAC,SAAS;QAC5B,SAAS,EAAE,MAAM,CAAC,QAAQ;QAC1B,UAAU,EAAE,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE;QAC3D,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE;QAC3C,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE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