Get Recipes
get_recipesRetrieve saved recipes from AnyList with details like name, rating, cook time, prep time, and servings. Filter recipes by name using optional search to find specific dishes.
Instructions
List all saved recipes from the AnyList account. Returns name, rating, cook time, prep time, and servings for each recipe. Use the optional search parameter to filter by name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| search | No | Optional text to filter recipes by name (case-insensitive) |
Implementation Reference
- src/tools/recipes.ts:16-45 (handler)The handler logic for the 'get_recipes' tool, which fetches recipes from the AnyList client and filters them if a search term is provided.
async ({ search }) => { try { const client = AnyListClient.getInstance(); const recipes = await client.getRecipes(); let filtered = recipes; if (search) { const term = search.toLowerCase(); filtered = recipes.filter((r) => r.name?.toLowerCase().includes(term)); } const summary = filtered.map((r) => ({ id: r.identifier, name: r.name, rating: r.rating ?? null, cookTime: r.cookTime ?? null, prepTime: r.prepTime ?? null, servings: r.servings ?? null, })); return { content: [{ type: 'text', text: JSON.stringify(summary, null, 2) }], }; } catch (error) { return { content: [{ type: 'text', text: `Error fetching recipes: ${error instanceof Error ? error.message : String(error)}` }], isError: true, }; } }, - src/tools/recipes.ts:12-14 (schema)The Zod schema defining the input parameters for the 'get_recipes' tool.
inputSchema: z.object({ search: z.string().optional().describe('Optional text to filter recipes by name (case-insensitive)'), }), - src/tools/recipes.ts:6-15 (registration)The registration of the 'get_recipes' tool within the MCP server.
server.registerTool( 'get_recipes', { title: 'Get Recipes', description: 'List all saved recipes from the AnyList account. Returns name, rating, cook time, prep time, and servings for each recipe. Use the optional search parameter to filter by name.', inputSchema: z.object({ search: z.string().optional().describe('Optional text to filter recipes by name (case-insensitive)'), }), },