Skip to main content
Glama

update_preferences

Modify dietary preferences, allergen restrictions, and cuisine choices for personalized HelloFresh meal recommendations.

Instructions

Update your dietary and cuisine preferences on HelloFresh, such as vegetarian mode, allergen avoidance, and preferred cuisines.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vegetarianNoEnable/disable vegetarian meal preference
family_friendlyNoEnable/disable family-friendly meals
dietary_preferencesNoList of dietary preferences to set
allergensNoList of allergens to avoid
cuisine_preferencesNoPreferred cuisine types

Implementation Reference

  • The handler for the 'update_preferences' tool that parses input with UpdatePreferencesSchema and calls this.hellofresh.updatePreferences() with mapped parameters
    case "update_preferences": {
      const params = UpdatePreferencesSchema.parse(args);
      const result = await this.hellofresh.updatePreferences({
        vegetarian: params.vegetarian,
        familyFriendly: params.family_friendly,
        dietaryPreferences: params.dietary_preferences,
        allergens: params.allergens,
        cuisinePreferences: params.cuisine_preferences,
      });
      return text(result);
    }
  • The actual implementation of updatePreferences() that navigates to HelloFresh preferences page via Playwright and updates vegetarian and family-friendly checkboxes
    async updatePreferences(
      preferences: Partial<Preferences>
    ): Promise<{ success: boolean; message: string }> {
      await this.ensureLoggedIn();
      const page = this.page!;
    
      await page.goto(`${this.baseUrl}/my-account/preferences`);
      await page.waitForLoadState("networkidle");
    
      // Update dietary preferences
      if (preferences.vegetarian !== undefined) {
        const vegCheckbox = page.locator(
          'input[value*="vegetarian"], [data-testid*="vegetarian"]'
        );
        if (await vegCheckbox.isVisible()) {
          const isChecked = await vegCheckbox.isChecked();
          if (preferences.vegetarian !== isChecked) {
            await vegCheckbox.click();
          }
        }
      }
    
      if (preferences.familyFriendly !== undefined) {
        const familyCheckbox = page.locator(
          'input[value*="family"], [data-testid*="family"]'
        );
        if (await familyCheckbox.isVisible()) {
          const isChecked = await familyCheckbox.isChecked();
          if (preferences.familyFriendly !== isChecked) {
            await familyCheckbox.click();
          }
        }
      }
    
      // Save preferences
      const saveBtn = page.locator(
        'button:has-text("Save"), button[type="submit"], [data-testid*="save-preferences"]'
      );
      if (await saveBtn.isVisible({ timeout: 3000 })) {
        await saveBtn.click();
        await page.waitForLoadState("networkidle");
      }
    
      return { success: true, message: "Preferences updated successfully." };
    }
  • UpdatePreferencesSchema - Zod schema defining input validation for vegetarian, family_friendly, dietary_preferences, allergens, and cuisine_preferences fields
    const UpdatePreferencesSchema = z.object({
      vegetarian: z
        .boolean()
        .optional()
        .describe("Enable/disable vegetarian meal preference"),
      family_friendly: z
        .boolean()
        .optional()
        .describe("Enable/disable family-friendly meals"),
      dietary_preferences: z
        .array(z.string())
        .optional()
        .describe("List of dietary preferences to set"),
      allergens: z
        .array(z.string())
        .optional()
        .describe("List of allergens to avoid"),
      cuisine_preferences: z
        .array(z.string())
        .optional()
        .describe("Preferred cuisine types"),
    });
  • src/index.ts:254-285 (registration)
    Tool registration for 'update_preferences' with description and JSON Schema inputSchema defining the tool's API contract for MCP clients
      name: "update_preferences",
      description:
        "Update your dietary and cuisine preferences on HelloFresh, such as vegetarian mode, allergen avoidance, and preferred cuisines.",
      inputSchema: {
        type: "object",
        properties: {
          vegetarian: {
            type: "boolean",
            description: "Enable/disable vegetarian meal preference",
          },
          family_friendly: {
            type: "boolean",
            description: "Enable/disable family-friendly meals",
          },
          dietary_preferences: {
            type: "array",
            items: { type: "string" },
            description: "List of dietary preferences to set",
          },
          allergens: {
            type: "array",
            items: { type: "string" },
            description: "List of allergens to avoid",
          },
          cuisine_preferences: {
            type: "array",
            items: { type: "string" },
            description: "Preferred cuisine types",
          },
        },
      },
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/markswendsen-code/mcp-hellofresh'

If you have feedback or need assistance with the MCP directory API, please join our Discord server