Summary
Integrate a persistent SQLite database for resolving recipe ingredients to specific Colruyt product IDs using rapidfuzz for string similarity lookup, and scraping detailed product specifications from the Colruyt RTI portal.
Motivation
- Persist User Choices: Store associations between a cleaned ingredient name and a specific Colruyt product.
- Fuzzy Search Lookup: Query the database using fuzzy matching (
rapidfuzz) before hitting the live APIs or asking the user.
- Scrape Rich Metadata: Dynamically fetch product details (description, content, conservation info, usage info) from
rti.colruytgroup.com so the AI assistant can auto-resolve ambiguities before prompting the user.
- MCP API Refactoring: Keep the server interface clean and focused by exposing high-level resolution and mapping tools.
Proposed Solution
- Database Storage and Schema:
- Database File:
resources/colruyt_mappings.db.
- Table
product_mappings: cleaned_ingredient (TEXT PRIMARY KEY), product_id (TEXT NOT NULL), product_name (TEXT NOT NULL), product_brand (TEXT), product_description (TEXT), conservation_info (TEXT), usage_info (TEXT), content (TEXT), created_at (TIMESTAMP DEFAULT CURRENT_TIMESTAMP).
- Fuzzy Matching:
- Install
rapidfuzz as a dependency.
- Use
rapidfuzz.process.extractOne to check the database before executing search (threshold >= 80/100, token_sort_ratio).
- Scraping Strategy:
- Fetch specifications from
rti.colruytgroup.com/nl/product-info/{technicalArticleNumber} matching the first GTIN or first available barcode block.
- MCP Tools changes:
- Expose new
resolve_ingredient and save_product_mapping tools.
- Keep
add_recipe_to_list and add_items_to_list.
- Remove
get_most_bought_products and search_products from public tools.
Summary
Integrate a persistent SQLite database for resolving recipe ingredients to specific Colruyt product IDs using
rapidfuzzfor string similarity lookup, and scraping detailed product specifications from the Colruyt RTI portal.Motivation
rapidfuzz) before hitting the live APIs or asking the user.rti.colruytgroup.comso the AI assistant can auto-resolve ambiguities before prompting the user.Proposed Solution
resources/colruyt_mappings.db.product_mappings:cleaned_ingredient(TEXT PRIMARY KEY),product_id(TEXT NOT NULL),product_name(TEXT NOT NULL),product_brand(TEXT),product_description(TEXT),conservation_info(TEXT),usage_info(TEXT),content(TEXT),created_at(TIMESTAMP DEFAULT CURRENT_TIMESTAMP).rapidfuzzas a dependency.rapidfuzz.process.extractOneto check the database before executing search (threshold >= 80/100,token_sort_ratio).rti.colruytgroup.com/nl/product-info/{technicalArticleNumber}matching the first GTIN or first available barcode block.resolve_ingredientandsave_product_mappingtools.add_recipe_to_listandadd_items_to_list.get_most_bought_productsandsearch_productsfrom public tools.