Skip to main content
Glama
t2hnd

Bakery Data MCP Server

by t2hnd

query_products

Search bakery product data by code, name, department, price range, or tags to find specific items in the catalog.

Instructions

Query product master data. Search by product code, name, department, price range, or tags.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
plu_codeNoProduct PLU code. Optional.
product_nameNoProduct name to search (partial match). Optional.
department_idNoDepartment ID. Optional.
min_priceNoMinimum price. Optional.
max_priceNoMaximum price. Optional.
tagNoSearch products by tag (uses extended product table). Optional.
include_tagsNoInclude tag information in results. Default: false.
limitNoMaximum number of results. Default: 100.

Implementation Reference

  • Handler logic for the 'query_products' tool within the call_tool function. Builds a dynamic SQL query to fetch products from 'products' or 'products_extended' table based on filters like plu_code, product_name, department_id, price range, and tags. Executes the query and returns JSON-formatted results.
    elif name == "query_products": # Determine which table to use include_tags = arguments.get("include_tags", False) has_tag_filter = "tag" in arguments table = "products_extended" if (include_tags or has_tag_filter) else "products" query = f"SELECT * FROM {table} WHERE 1=1" params = [] if "plu_code" in arguments: query += " AND plu_code = ?" params.append(arguments["plu_code"]) if "product_name" in arguments: query += " AND product_name LIKE ?" params.append(f"%{arguments['product_name']}%") if "department_id" in arguments: query += " AND department_id = ?" params.append(arguments["department_id"]) if "min_price" in arguments: query += " AND price >= ?" params.append(arguments["min_price"]) if "max_price" in arguments: query += " AND price <= ?" params.append(arguments["max_price"]) if has_tag_filter: query += " AND tags LIKE ?" params.append(f"%{arguments['tag']}%") query += " LIMIT ?" params.append(arguments.get("limit", 100)) cursor.execute(query, params) results = cursor.fetchall() return [TextContent( type="text", text=json.dumps(results, ensure_ascii=False, indent=2) )]
  • Registration of the 'query_products' tool in the list_tools() function, including the tool name, description, and input schema definition.
    Tool( name="query_products", description="Query product master data. Search by product code, name, department, price range, or tags.", inputSchema={ "type": "object", "properties": { "plu_code": { "type": "string", "description": "Product PLU code. Optional." }, "product_name": { "type": "string", "description": "Product name to search (partial match). Optional." }, "department_id": { "type": "number", "description": "Department ID. Optional." }, "min_price": { "type": "number", "description": "Minimum price. Optional." }, "max_price": { "type": "number", "description": "Maximum price. Optional." }, "tag": { "type": "string", "description": "Search products by tag (uses extended product table). Optional." }, "include_tags": { "type": "boolean", "description": "Include tag information in results. Default: false." }, "limit": { "type": "number", "description": "Maximum number of results. Default: 100." } } } ),
  • Input schema definition for the 'query_products' tool, specifying properties for filtering products.
    inputSchema={ "type": "object", "properties": { "plu_code": { "type": "string", "description": "Product PLU code. Optional." }, "product_name": { "type": "string", "description": "Product name to search (partial match). Optional." }, "department_id": { "type": "number", "description": "Department ID. Optional." }, "min_price": { "type": "number", "description": "Minimum price. Optional." }, "max_price": { "type": "number", "description": "Maximum price. Optional." }, "tag": { "type": "string", "description": "Search products by tag (uses extended product table). Optional." }, "include_tags": { "type": "boolean", "description": "Include tag information in results. Default: false." }, "limit": { "type": "number", "description": "Maximum number of results. Default: 100." } } }

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/t2hnd/bakery_data_mcp'

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