Skip to main content
Glama
thinq-connect

ThinQ Connect MCP Server

Official

post_device_control

Send control commands to a specific device on the ThinQ Connect platform to modify its settings or state.

Instructions

Send control commands to a specific device on the ThinQ Connect platform to change its settings or state Args: device_type: Device type (e.g., DEVICE_AIR_CONDITIONER, DEVICE_ROBOT_CLEANER, DEVICE_STYLER) device_id: Unique ID of the device to control control_method: Co ntrol method name to execute (e.g., set_air_con_operation_mode, set_target_temperature, set_wind_strength) control_params: Parameter dictionary to pass to the control method (e.g., {'operation': 'POWER_OFF'}, {'temperature': 25}, {'wind_strength': 'HIGH'})

Returns:
    String containing device control result message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_typeYes
device_idYes
control_methodYes
control_paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The tool is registered with the MCP server via the @mcp.tool decorator. Defines parameters (device_type, device_id, control_method, control_params) and delegates to the handler in tools.py.
    @mcp.tool(
        description="""Send control commands to a specific device on the ThinQ Connect platform to change its settings or state
        Args:
            device_type: Device type (e.g., DEVICE_AIR_CONDITIONER, DEVICE_ROBOT_CLEANER, DEVICE_STYLER)
            device_id: Unique ID of the device to control
            control_method: Co ntrol method name to execute (e.g., set_air_con_operation_mode, set_target_temperature, set_wind_strength)
            control_params: Parameter dictionary to pass to the control method (e.g., {'operation': 'POWER_OFF'}, {'temperature': 25}, {'wind_strength': 'HIGH'})
    
        Returns:
            String containing device control result message
        """
    )
    async def post_device_control(
        device_type: str,
        device_id: str,
        control_method: str,
        control_params: dict,
    ) -> str:
        return await tools.post_device_control(
            thinq_api=thinq_api,
            device_type=device_type,
            device_id=device_id,
            control_method=control_method,
            control_params=control_params,
        )
  • The handler function that executes the device control logic. It resolves the device profile (with caching), looks up the device class, creates a device instance, inspects the method signature, converts parameter types, and calls the method with kwargs.
    async def post_device_control(
        thinq_api: ThinQApi,
        device_type: str,
        device_id: str,
        control_method: str,
        control_params: dict,
    ) -> str:
        """
        Device Control
        """
        try:
            global local_device_profiles
            thinq_api._session = ClientSession()
            if not local_device_profiles.get(device_id):
                device_profile = await thinq_api.async_get_device_profile(device_id=device_id)
                local_device_profiles[device_id] = device_profile
            else:
                device_profile = local_device_profiles[device_id]
    
            device_class = device_class_mapping.get(device_type)
            if not device_class:
                raise ValueError(f"Unsupported device type: {device_type}")
    
            # Create device object
            device = device_class(
                thinq_api=thinq_api,
                device_id=device_id,
                device_type=device_type,
                model_name="model_name",
                alias="alias",
                reportable=True,
                profile=device_profile,
            )
    
            # Call device control method
            if hasattr(device, control_method):
                method = getattr(device, control_method)
                sig = inspect.signature(method)  # Get method signature (parameter information)
    
                # Prepare arguments for each method parameter
                kwargs = {}
                for param_name, param in sig.parameters.items():
                    if param_name in control_params:
                        param_type = param.annotation
                        value = control_params[param_name]
    
                        # Convert based on parameter type
                        if param_type == int or param_type == "int":
                            kwargs[param_name] = int(value)
                        elif param_type == str or param_type == "str":
                            kwargs[param_name] = str(value)
                        else:
                            kwargs[param_name] = value
    
                await method(**kwargs)
            else:
                return f"Command '{control_method}' not found."
    
            return f"Device control completed. Please relay appropriately to the user. Command: {control_method}, Parameters: {control_params}"
        except Exception as e:
            return f"An error occurred during device control: {str(e)}, Command: {control_method}, Parameters: {control_params}"
  • The helper mapping used by the handler to resolve device_type strings to concrete device classes from the thinqconnect library.
    device_class_mapping = {
        "DEVICE_AIR_CONDITIONER": AirConditionerDevice,
        "DEVICE_AIR_PURIFIER": AirPurifierDevice,
        "DEVICE_AIR_PURIFIER_FAN": AirPurifierFanDevice,
        "DEVICE_CEILING_FAN": CeilingFanDevice,
        "DEVICE_COOKTOP": CooktopDevice,
        "DEVICE_DEHUMIDIFIER": DehumidifierDevice,
        "DEVICE_DISH_WASHER": DishWasherDevice,
        "DEVICE_DRYER": DryerDevice,
        "DEVICE_HOME_BREW": HomeBrewDevice,
        "DEVICE_HOOD": HoodDevice,
        "DEVICE_HUMIDIFIER": HumidifierDevice,
        "DEVICE_KIMCHI_REFRIGERATOR": KimchiRefrigeratorDevice,
        "DEVICE_MICROWAVE_OVEN": MicrowaveOvenDevice,
        "DEVICE_OVEN": OvenDevice,
        "DEVICE_PLANT_CULTIVATOR": PlantCultivatorDevice,
        "DEVICE_REFRIGERATOR": RefrigeratorDevice,
        "DEVICE_ROBOT_CLEANER": RobotCleanerDevice,
        "DEVICE_STICK_CLEANER": StickCleanerDevice,
        "DEVICE_STYLER": StylerDevice,
        "DEVICE_SYSTEM_BOILER": SystemBoilerDevice,
        "DEVICE_VENTILATOR": VentilatorDevice,
        "DEVICE_WASHCOMBO_MAIN": WashcomboMainDevice,
        "DEVICE_WASHCOMBO_MINI": WashcomboMiniDevice,
        "DEVICE_WASHER": WasherDevice,
        "DEVICE_WASHTOWER": WashtowerDevice,
        "DEVICE_WASHTOWER_DRYER": WashtowerDryerDevice,
        "DEVICE_WASHTOWER_WASHER": WashtowerWasherDevice,
        "DEVICE_WATER_HEATER": WaterHeaterDevice,
        "DEVICE_WATER_PURIFIER": WaterPurifierDevice,
        "DEVICE_WINE_CELLAR": WineCellarDevice,
    }
Behavior2/5

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

With no annotations, the description bears full burden for behavioral disclosure. It implies mutation but does not disclose potential side effects, required permissions, rate limits, error conditions, or idempotency. The return type (string message) is mentioned but is vague.

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 largely concise and structured with Args and Returns sections. It front-loads the purpose. A minor typo ('Co ntrol') slightly detracts, but overall efficient.

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 complexity (4 required params, nested object), the description covers basic usage but lacks context on authentication, error handling, supported control methods per device type, and output schema details (returns only a vague string message). Output schema exists but is not leveraged in the description.

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 value beyond the input schema by listing each parameter with examples (e.g., device_type values, control_params as a dictionary). However, schema description coverage is 0%, and the description does not enumerate all valid values for enums or provide detailed formatting rules, relying on self-explanatory parameter names.

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 action: sending control commands to change device settings or state. It provides example parameters for device types, control methods, and parameters, making the purpose explicit. While it doesn't explicitly differentiate from sibling tools, the action verb and mutation nature distinguish it from read-only siblings like get_device_status.

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 lacks guidance on when to use this tool versus alternatives, such as when to query available controls via get_device_available_controls first or prerequisites like device authentication. No context for appropriate usage contexts or exclusions is provided.

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/thinq-connect/thinqconnect-mcp'

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