Skip to main content
Glama
t2hnd

Bakery Data MCP Server

by t2hnd

query_transactions

Retrieve and filter bakery POS transaction records by date, product, payment method, or amount to analyze sales data.

Instructions

Query POS transaction data. Supports filtering by date range, product code/name, payment method, and amount range. Returns transaction details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateNoStart date (YYYY-MM-DD format). Optional.
end_dateNoEnd date (YYYY-MM-DD format). Optional.
product_codeNoProduct code to filter by. Optional.
product_nameNoProduct name to search (partial match). Optional.
payment_methodNoPayment method (e.g., '現金', 'クレジット'). Optional.
min_amountNoMinimum transaction amount. Optional.
max_amountNoMaximum transaction amount. Optional.
limitNoMaximum number of results to return. Default: 100.

Implementation Reference

  • The core handler logic within the call_tool function that processes input arguments, dynamically builds an SQL query to filter transactions table based on provided parameters, executes the query using the database cursor, fetches results, and returns them as JSON-formatted text content.
    if name == "query_transactions": # Build query with filters query = "SELECT * FROM transactions WHERE 1=1" params = [] if "start_date" in arguments: query += " AND datetime >= ?" params.append(arguments["start_date"]) if "end_date" in arguments: query += " AND datetime <= ?" params.append(arguments["end_date"] + " 23:59:59") if "product_code" in arguments: query += " AND product_code = ?" params.append(arguments["product_code"]) if "product_name" in arguments: query += " AND product_name LIKE ?" params.append(f"%{arguments['product_name']}%") if "payment_method" in arguments: query += " AND payment_method = ?" params.append(arguments["payment_method"]) if "min_amount" in arguments: query += " AND amount >= ?" params.append(arguments["min_amount"]) if "max_amount" in arguments: query += " AND amount <= ?" params.append(arguments["max_amount"]) query += " ORDER BY datetime DESC 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) )]
  • Input schema for the query_transactions tool, defining optional parameters for filtering by date range, product details, payment method, amount range, and result limit.
    inputSchema={ "type": "object", "properties": { "start_date": { "type": "string", "description": "Start date (YYYY-MM-DD format). Optional." }, "end_date": { "type": "string", "description": "End date (YYYY-MM-DD format). Optional." }, "product_code": { "type": "string", "description": "Product code to filter by. Optional." }, "product_name": { "type": "string", "description": "Product name to search (partial match). Optional." }, "payment_method": { "type": "string", "description": "Payment method (e.g., '現金', 'クレジット'). Optional." }, "min_amount": { "type": "number", "description": "Minimum transaction amount. Optional." }, "max_amount": { "type": "number", "description": "Maximum transaction amount. Optional." }, "limit": { "type": "number", "description": "Maximum number of results to return. Default: 100." } } }
  • Registration of the query_transactions tool in the list_tools() function via the MCP Tool object, including name, description, and input schema.
    Tool( name="query_transactions", description="Query POS transaction data. Supports filtering by date range, product code/name, payment method, and amount range. Returns transaction details.", inputSchema={ "type": "object", "properties": { "start_date": { "type": "string", "description": "Start date (YYYY-MM-DD format). Optional." }, "end_date": { "type": "string", "description": "End date (YYYY-MM-DD format). Optional." }, "product_code": { "type": "string", "description": "Product code to filter by. Optional." }, "product_name": { "type": "string", "description": "Product name to search (partial match). Optional." }, "payment_method": { "type": "string", "description": "Payment method (e.g., '現金', 'クレジット'). Optional." }, "min_amount": { "type": "number", "description": "Minimum transaction amount. Optional." }, "max_amount": { "type": "number", "description": "Maximum transaction amount. Optional." }, "limit": { "type": "number", "description": "Maximum number of results to return. 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