Skip to main content
Glama
by t2hnd

query_departments

Retrieve bakery department information by ID or name to access product categories and organizational data from the point-of-sale system.

Instructions

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

Input Schema

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

Input Schema (JSON Schema)

{ "properties": { "department_id": { "description": "Department ID. Optional.", "type": "number" }, "department_name": { "description": "Department name to search (partial match). Optional.", "type": "string" } }, "type": "object" }

Implementation Reference

  • Handler implementation for query_departments tool. Executes SQL query on departments table with optional filters for department_id or department_name (partial match), fetches results as dicts, and returns as JSON 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) )]
  • Registration of the query_departments tool in list_tools(), including name, description, and inputSchema defining optional department_id (number) and department_name (string).
    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." } } } ),
  • Input schema for query_departments tool, defining properties for optional department_id and department_name filters.
    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