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

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that the tool 'Returns all departments or filter by ID/name,' which implies read-only behavior and filtering capabilities. However, it lacks details on permissions, rate limits, pagination, error handling, or what 'master data' entails. For a query tool with zero annotation coverage, this is insufficient to fully inform the agent.

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 and front-loaded: two sentences that directly state the tool's function and filtering options. There's no wasted verbiage, repetition, or unnecessary details. Every word earns its place, making it easy for an agent to parse quickly.

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?

Given the tool's moderate complexity (a query with filtering), no annotations, no output schema, and 100% schema coverage, the description is partially complete. It covers the basic purpose and parameters but lacks behavioral context and output details. It's adequate for a simple query tool but doesn't fully compensate for the missing annotations and output schema.

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?

The description adds minimal value beyond the input schema. It states 'filter by ID/name,' which aligns with the schema's parameters (department_id and department_name). However, with 100% schema description coverage, the schema already documents these parameters well. The description doesn't provide additional context like format examples or usage tips, so it 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: 'Query department master data' specifies the verb (query) and resource (department master data). It distinguishes from siblings like query_products and query_transactions by focusing on departments. However, it doesn't explicitly differentiate from get_schema or execute_sql, which might also query data, so it's not a perfect 5.

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. It doesn't mention when to choose query_departments over execute_sql for department queries, or how it relates to siblings like get_schema. There's no context on prerequisites, exclusions, or typical use cases, leaving the agent with minimal direction.

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