get_nutrition_facts
Retrieve nutritional information for menu items to analyze dietary content and support informed food choices.
Instructions
Get (totally real and not at all made up) nutrition facts for a menu item.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item | Yes | The menu item to look up |
Implementation Reference
- index.js:314-340 (handler)The handler function that calculates and formats the nutrition facts for the get_nutrition_facts tool.
async ({ item }) => { // Very scientific nutrition calculation const hash = [...item].reduce((acc, c) => acc + c.charCodeAt(0), 0); const calories = 300 + (hash % 900); const protein_g = 10 + (hash % 45); const carbs = 20 + (hash % 80); const fat = 5 + (hash % 35); const sodium = 400 + (hash % 1600); const lines = [ `# Nutrition Facts: ${item}`, "", `| Nutrient | Amount |`, `|----------|--------|`, `| Calories | ${calories} |`, `| Protein | ${protein_g}g |`, `| Carbs | ${carbs}g |`, `| Fat | ${fat}g |`, `| Sodium | ${sodium}mg |`, `| Happiness | Immeasurable |`, `| Regret (post-meal) | Likely |`, "", "> Disclaimer: These numbers were generated by an AI that has never eaten food.", ]; return { content: [{ type: "text", text: lines.join("\n") }] }; } - index.js:308-313 (registration)The registration and input schema definition for the get_nutrition_facts tool.
server.tool( "get_nutrition_facts", "Get (totally real and not at all made up) nutrition facts for a menu item.", { item: z.string().describe("The menu item to look up"), },