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."
            }
        }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions search functionality but doesn't describe important behavioral aspects like whether this is a read-only operation, how results are returned (format, pagination), performance characteristics, or any limitations. The description is functional but lacks transparency about how the tool behaves beyond basic search.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - just two sentences that efficiently communicate the core functionality and search parameters. Every word earns its place with no wasted text. It's front-loaded with the main purpose and follows with specific search capabilities.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a query tool with 8 parameters, 100% schema coverage, but no annotations and no output schema, the description provides adequate basic information about what the tool does. However, it lacks important context about result format, limitations, or how this fits within the broader tool ecosystem. The description is complete enough to understand the tool's function but not complete enough for optimal agent usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 8 parameters thoroughly. The description adds minimal value by listing search criteria (product code, name, department, price range, tags) which aligns with some parameters, but doesn't provide additional semantic context beyond what's in the schema. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Query product master data' with specific search criteria (product code, name, department, price range, tags), which is a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from sibling tools like 'query_departments' or 'query_transactions' in terms of data domain, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'top_products' or 'execute_sql'. It lists search criteria but doesn't indicate whether this is the primary product search tool or if there are specific scenarios where other tools might be more appropriate. No exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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