tools.ts•4.04 kB
import { Tool } from '@modelcontextprotocol/sdk/types.js';
export const tools: Tool[] = [
{
name: "get_product",
description: "Retrieve detailed information about a food product by its barcode",
inputSchema: {
type: "object",
properties: {
barcode: {
type: "string",
description: "The barcode/ID of the product (e.g., '3017620422003')",
},
},
required: ["barcode"],
},
},
{
name: "search_products",
description: "Search for food products with various filters and criteria",
inputSchema: {
type: "object",
properties: {
search: {
type: "string",
description: "Search terms for product names, brands, or ingredients",
},
categories: {
type: "string",
description: "Filter by categories (e.g., 'beverages', 'dairy')",
},
brands: {
type: "string",
description: "Filter by brand names",
},
countries: {
type: "string",
description: "Filter by countries (e.g., 'france', 'united-states')",
},
nutrition_grades: {
type: "string",
description: "Filter by Nutri-Score grades (a, b, c, d, e)",
},
nova_groups: {
type: "string",
description: "Filter by NOVA processing groups (1, 2, 3, 4)",
},
sort_by: {
type: "string",
description: "Sort results by: popularity, product_name, created_datetime, last_modified_datetime",
enum: ["popularity", "product_name", "created_datetime", "last_modified_datetime"],
},
page: {
type: "number",
description: "Page number for pagination (default: 1)",
minimum: 1,
},
page_size: {
type: "number",
description: "Number of results per page (default: 20, max: 100)",
minimum: 1,
maximum: 100,
},
},
required: [],
},
},
{
name: "analyze_product",
description: "Get nutritional analysis and scores for a product by barcode",
inputSchema: {
type: "object",
properties: {
barcode: {
type: "string",
description: "The barcode/ID of the product to analyze",
},
},
required: ["barcode"],
},
},
{
name: "compare_products",
description: "Compare nutritional information between multiple products",
inputSchema: {
type: "object",
properties: {
barcodes: {
type: "array",
items: {
type: "string",
},
description: "Array of product barcodes to compare (max 10)",
maxItems: 10,
minItems: 2,
},
focus: {
type: "string",
description: "Focus comparison on specific aspect",
enum: ["nutrition", "ingredients", "environmental", "processing"],
},
},
required: ["barcodes"],
},
},
{
name: "get_product_suggestions",
description: "Get product suggestions based on dietary preferences or restrictions",
inputSchema: {
type: "object",
properties: {
category: {
type: "string",
description: "Product category to search within",
},
dietary_preferences: {
type: "array",
items: {
type: "string",
enum: ["vegan", "vegetarian", "gluten-free", "organic", "low-fat", "low-sugar", "high-protein"],
},
description: "Dietary preferences or restrictions",
},
max_results: {
type: "number",
description: "Maximum number of suggestions (default: 10)",
minimum: 1,
maximum: 50,
},
min_nutriscore: {
type: "string",
description: "Minimum Nutri-Score grade (a, b, c, d, e)",
enum: ["a", "b", "c", "d", "e"],
},
},
required: ["category"],
},
},
];