Skip to main content
Glama

led_control

Control LED lights on IoT devices through MQTT by setting them to on or off states using natural language commands.

Instructions

控制LED开关

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stateYesLED状态(on/off)

Implementation Reference

  • Handler logic for the 'led_control' tool: validates the 'state' parameter to be 'on' or 'off', constructs the MQTT message 'LED {state}', and returns error if invalid.
    elif name == "led_control":
        state = arguments.get("state", "").lower()
        if state not in ["on", "off"]:
            return [types.TextContent(
                type="text",
                text="Error: State must be 'on' or 'off'"
            )]
        message = f"LED {state}"
  • Registers all tools including 'led_control' from config.tools, providing name, description, and dynamically constructed inputSchema based on tool parameters defined in config.yaml.
    for tool_name, tool_config in config.tools.items():
        tools.append(
            types.Tool(
                name=tool_config.name,
                description=tool_config.description,
                inputSchema={
                    "type": "object",
                    "properties": {
                        param["name"]: {
                            "type": param["type"],
                            "description": param["description"],
                            **({"enum": param["enum"]} if "enum" in param else {})
                        }
                        for param in tool_config.parameters
                    },
                    "required": [
                        param["name"]
                        for param in tool_config.parameters
                        if param.get("required", False)
                    ]
                }
            )
        )
    return tools
  • Dynamically generates the input schema for 'led_control' (and other tools) from the parameters defined in the configuration file.
                inputSchema={
                    "type": "object",
                    "properties": {
                        param["name"]: {
                            "type": param["type"],
                            "description": param["description"],
                            **({"enum": param["enum"]} if "enum" in param else {})
                        }
                        for param in tool_config.parameters
                    },
                    "required": [
                        param["name"]
                        for param in tool_config.parameters
                        if param.get("required", False)
                    ]
                }
            )
        )
    return tools
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action ('控制LED开关') but doesn't disclose behavioral traits such as required permissions, whether it's a read/write operation, side effects, or response format. The description is minimal and lacks context needed for safe invocation.

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

Conciseness4/5

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

The description is a single, efficient phrase ('控制LED开关') with zero waste. It's appropriately sized for a simple tool, though it could be more informative. The structure is front-loaded but lacks depth, earning a high score for brevity.

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

Completeness2/5

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

Given the tool's simplicity (1 parameter, 100% schema coverage) but lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns or any behavioral context, making it inadequate for full understanding despite the straightforward input.

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%, with the parameter 'state' fully documented in the schema (including enum values 'on'/'off'). The description adds no additional meaning beyond what the schema provides, so it meets the baseline of 3 where the schema does the heavy lifting.

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

Purpose3/5

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

The description '控制LED开关' (control LED switch) states the basic function but is vague about what specific LED resource it controls. It uses a verb ('控制') and resource ('LED开关'), but doesn't distinguish from sibling tools like 'set_pwm' which might also control LEDs. The purpose is understandable but lacks specificity about scope or target.

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?

No guidance is provided on when to use this tool versus alternatives like 'set_pwm'. The description implies it's for turning LEDs on/off, but there's no explicit context, prerequisites, or exclusions mentioned. Without annotations or sibling differentiation, usage is implied rather than clearly defined.

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/mcp2everything/mcp2mqtt'

If you have feedback or need assistance with the MCP directory API, please join our Discord server