Skip to main content
Glama
t2hnd

Bakery Data MCP Server

by t2hnd

query_departments

Retrieve bakery department information by ID or name to access product categories and organizational data for sales analysis and inventory management.

Instructions

Query department master data. Returns all departments or filter by ID/name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
department_idNoDepartment ID. Optional.
department_nameNoDepartment name to search (partial match). Optional.

Implementation Reference

  • Implements the handler logic for the 'query_departments' tool. Constructs a dynamic SQL query to select from the 'departments' table, applying optional filters for 'department_id' and 'department_name' (partial match), executes it, and returns the results as JSON-formatted text content.
    elif name == "query_departments": query = "SELECT * FROM departments WHERE 1=1" params = [] if "department_id" in arguments: query += " AND department_id = ?" params.append(arguments["department_id"]) if "department_name" in arguments: query += " AND department_name LIKE ?" params.append(f"%{arguments['department_name']}%") cursor.execute(query, params) results = cursor.fetchall() return [TextContent( type="text", text=json.dumps(results, ensure_ascii=False, indent=2) )]
  • Registers the 'query_departments' tool in the list_tools() function, providing its name, description, and input schema for validation.
    Tool( name="query_departments", description="Query department master data. Returns all departments or filter by ID/name.", inputSchema={ "type": "object", "properties": { "department_id": { "type": "number", "description": "Department ID. Optional." }, "department_name": { "type": "string", "description": "Department name to search (partial match). Optional." } } } ),
  • Defines the input schema for the 'query_departments' tool, specifying optional parameters for department_id (number) and department_name (string).
    inputSchema={ "type": "object", "properties": { "department_id": { "type": "number", "description": "Department ID. Optional." }, "department_name": { "type": "string", "description": "Department name to search (partial match). Optional." } } }

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