Skip to main content
Glama
thinq-connect

ThinQ Connect MCP Server

Official

get_device_available_controls

Query a specific LG ThinQ device by type and ID to retrieve all available control commands and parameter information.

Instructions

Retrieves available control commands and parameter information for a specific device Args: device_type: Device type (e.g., DEVICE_AIR_CONDITIONER, DEVICE_ROBOT_CLEANER, DEVICE_STYLER) device_id: Unique ID of the device to query

Returns:
    String containing device control commands and parameter information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_typeYes
device_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Registration of 'get_device_available_controls' as an MCP tool via @mcp.tool decorator. Delegates to tools.get_device_available_controls.
    @mcp.tool(
        description="""Retrieves available control commands and parameter information for a specific device
        Args:
            device_type: Device type (e.g., DEVICE_AIR_CONDITIONER, DEVICE_ROBOT_CLEANER, DEVICE_STYLER)
            device_id: Unique ID of the device to query
    
        Returns:
            String containing device control commands and parameter information
        """
    )
    async def get_device_available_controls(device_type: str, device_id: str) -> str:
        return await tools.get_device_available_controls(thinq_api=thinq_api, device_type=device_type, device_id=device_id)
  • Core handler implementation: fetches device profile (cached), creates device object from class mapping, inspects methods and writable properties, and returns a detailed control instruction guide as a formatted string.
    async def get_device_available_controls(thinq_api: ThinQApi, device_type: str, device_id: str) -> str:
        """
        Get available control command information from device
        """
        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,
            )
    
            device_methods = [
                (
                    name,
                    str(inspect.signature(getattr(device, name))).split(" -> ")[0],
                )  # (method name, parameter info)
                for name in dir(device)
                if callable(getattr(device, name))  # Check if it's a function
                and name not in dir(ConnectBaseDevice)  # Exclude inherited from parent class
                and not name.startswith("__")  # Exclude internal methods
            ]
            writable_properties = str(device.profiles.writable_properties)
            methods = "\n".join(map(str, device_methods))
            profile = str(device_profile)
            current_time = datetime.now()
            return f"""# Device Control Instruction Guide**
    This guide provides instructions for IoT device control using structured data formats:
    - **Profile**: JSON-based device capabilities and properties
    - **Writable Properties**: List of controllable device properties
    - **Methods**: List of available control methods
    
    ## Validation Rules (Critical)
    Before executing any control command, verify:
    1. **Property exists** in `Writable Properties` list
    2. **Method exists** in `Methods` list
    3. **Valid mapping** between method and property:
       - Standard format: `set_{{property_name}}`
       - Example: Method `set_air_con_operation_mode` maps to property `air_con_operation_mode`
       - Some methods handle multiple properties (e.g., `set_relative_time_to_start` for both `relative_hour_to_start` and `relative_minute_to_start`)
    4. **Both method AND property must be present** for control to be permitted
    
    **If validation fails**: Respond with `"This control is not supported on this device."`
    
    ## Naming Convention
    - **Profile JSON**: camelCase (`airConOperationMode`, `coolTargetTemperature`)
    - **Writable Properties & Methods**: snake_case (`air_con_operation_mode`, `cool_target_temperature`)
    Accurate camelCase ↔ snake_case mapping is essential for proper execution.
    
    ## Data Structures
    ### Writable Properties
    {writable_properties}
    ### Methods
    {methods}
    ### Profile
    {profile}
    
    ## Control Command Execution
    Use the `post_device_control` tool with these parameters:
    {{
      "device_type": "<DEVICE_TYPE>",
      "device_id": "<DEVICE_UNIQUE_ID>",
      "control_method": "<METHOD_NAME>",
      "control_params": {{
        "<param_name>": <param_value>
      }}
    }}
    
    ### Parameter Types & Validation
    Based on Profile `type` field:
    - **enum**: Must use exact values from Profile's `value` array
    - **boolean**: `true` or `false`
    - **number**: Numeric value
    - **range**: Value within `min`~`max` bounds, respecting `step` intervals
    
    ### Time-Based Controls
    **Current Time**: {current_time.strftime('%Y-%m-%d %H:%M:%S')}
    
    For time-related commands:
    - **Relative time requests** ("in 2 hours"): Calculate interval from current time
    - **Absolute time requests** ("turn on at 7 PM"): Convert to relative time if only relative control is supported
    - **Future time guarantee**: If requested time is past, assume next day
    - **Example calculation**:
      - Current: 15:20, Request: 19:00
      - Result: `{{"relative_hour_to_start": 3, "relative_minute_to_start": 40}}`
    
    ### Control Examples
    
    **Single parameter:**
    {{
      "control_method": "set_air_con_operation_mode",
      "control_params": {{"operation": "POWER_OFF"}}
    }}
    
    **Multiple parameters:**
    {{
      "control_method": "set_relative_time_to_start",
      "control_params": {{"hour": 10, "minute": 30}}
    }}
    ```
    
    ## Profile Structure Reference
    Profile JSON contains device capabilities with this structure:
    {{
      "propertyName": {{
        "type": "enum|boolean|number|range",
        "mode": ["r", "w"],  // r=readable, w=writable
        "value": {{
          "r": [/* readable values */],
          "w": [/* writable values */]
        }},
        "unit": "C|F|...",  // for temperature/measurement properties
        "min": 0,           // for range type
        "max": 100,         // for range type
        "step": 1           // for range type
      }}
    }}
    
    **Control Permission**: Property must have `"w"` in `mode` array to be controllable.
    ## Error Handling
    - **Power-off errors**: Check device status with `get_device_status` and turn on power first
    - **Invalid parameters**: Verify parameter values match Profile specifications
    - **Missing capabilities**: Use validation rules to confirm method/property support
    """
        except Exception as e:
            return f"An error occurred while retrieving device details: {str(e)}"
  • Supporting data: 'device_class_mapping' dictionary mapping device type strings to ThinQ device classes, and 'local_device_profiles' cache used by the handler.
    local_device_profiles = {}
    local_device_lists = []
    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?

No annotations are provided, so the description should disclose behavioral traits like side effects or permissions. It only states it retrieves information, but does not explicitly say it is read-only or safe. The lack of any behavioral notes (e.g., 'does not modify device state') leaves significant gaps for an AI agent assessing safety.

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 very concise with no unnecessary words. It front-loads the core purpose and structures parameter and return info in a clean, easy-to-scan format. Every sentence is useful.

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

Completeness4/5

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

Given the tool has only two parameters and an output schema (as indicated by context signals), the description covers the essentials: what the tool does, what parameters are needed, and that it returns a string. It does not elaborate on the contents of the string, but the output schema likely fills that gap. The sibling context is implicitly clear.

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 input schema has 0% description coverage, but the description adds meaning to both parameters by giving examples for device_type and clarifying device_id as 'Unique ID of the device to query'. However, it does not explain the format of the returned string or what 'control commands' entail, so it is adequate but not comprehensive.

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

Purpose5/5

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

The description clearly states 'Retrieves available control commands and parameter information for a specific device', specifying the verb 'retrieves' and the resource. It differentiates from siblings (get_device_list, get_device_status, post_device_control) by focusing on available controls rather than listing, status, or sending commands.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not provide explicit guidance on when to use this tool versus its siblings. It only states what it does, leaving the agent to infer context from the tool name and sibling names. No exclusions or alternatives are mentioned.

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