Skip to main content
Glama

get_device_status

Retrieve the current state and information for a WeMo smart home device using its name or IP address to monitor power status and device details.

Instructions

Get the current status of a WeMo device.

Retrieves the current state and information for a device by name or IP address. The device must have been discovered via scan_network first.

Args:

device_identifier: Device name (e.g., "Office Light") or IP address (e.g., "192.168.1.100")

Returns:

Dictionary containing:
- device_name: Name of the device
- state: Current state ("on" or "off")
- Additional device information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_identifierYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler for the 'get_device_status' MCP tool, which validates input, retrieves a device object from cache, and fetches status/state.
    async def get_device_status(device_identifier: str) -> dict[str, Any]:
        """Get the current status of a WeMo device.
    
        Retrieves the current state and information for a device by name or IP address.
        The device must have been discovered via scan_network first.
    
        Args:
        ----
            device_identifier: Device name (e.g., "Office Light") or IP address (e.g., "192.168.1.100")
    
        Returns:
        -------
            Dictionary containing:
            - device_name: Name of the device
            - state: Current state ("on" or "off")
            - Additional device information
    
        """
        # Validate input
        try:
            param = DeviceIdentifierParam(device_identifier=device_identifier)
        except ValidationError as e:
            return {
                "error": ERR_INVALID_PARAMS,
                "validation_errors": [
                    {"field": err["loc"][0], "message": err["msg"], "input": err["input"]}
                    for err in e.errors()
                ],
            }
    
        try:
            # Try to find device in memory cache, then reconnect from file cache if needed
            device = _device_cache.get(param.device_identifier)
            if not device:
                device = await _reconnect_device_from_cache(param.device_identifier)
    
            if not device:
                return {
                    "error": f"Device '{param.device_identifier}' not found in cache",
                    "suggestion": ERR_RUN_SCAN_FIRST,
                    "available_devices": [
                        k
                        for k in _device_cache
                        if isinstance(k, str) and not k.replace(".", "").isdigit()
                    ],
                }
    
            # Get device state with retry
            state = await _get_device_state_with_retry(device)
    
            # Extract full device info
            device_info = extract_device_info(device)
            device_info["state"] = "on" if state else "off"
            device_info["status_retrieved_at"] = time.time()
    
            # Add brightness for dimmer devices
            if hasattr(device, "get_brightness"):
                brightness = await _get_device_brightness_with_retry(device)
                device_info["brightness"] = brightness
                device_info["is_dimmer"] = True
            else:
                device_info["is_dimmer"] = False
    
            logger.info(
                f"Status retrieved for {device.name}: {device_info['state']}"
                + (
                    f" Brightness: {device_info.get('brightness')}"
                    if device_info.get("is_dimmer")
                    else ""
                ),
            )
            return device_info
    
        except Exception as e:
            logger.error(f"Error getting device status: {e}", exc_info=True)
            return build_error_response(
                e,
                "Get device status",
                context={"device_identifier": device_identifier},
            )
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that this is a read operation ('Retrieves'), mentions a prerequisite ('discovered via scan_network first'), and hints at the return format. However, it lacks details on error handling, rate limits, authentication needs, or whether the operation is idempotent, which are important for a tool interacting with physical devices.

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 well-structured with a clear purpose statement, usage note, and formatted parameter/return sections. It's appropriately sized for a single-parameter tool, though the 'Args' and 'Returns' headers are somewhat redundant given the structured schema fields, and the 'Additional device information' is vague.

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's moderate complexity (device status retrieval), no annotations, and the presence of an output schema (which handles return values), the description is reasonably complete. It covers purpose, prerequisites, parameter meaning, and return structure. However, it could better address behavioral aspects like error cases or performance characteristics for a network-connected device tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It provides meaningful semantics for the single parameter 'device_identifier', explaining it can be either a device name or IP address with clear examples. This adds substantial value beyond the bare schema, though it doesn't specify format constraints like IP validation or name uniqueness.

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 the specific action ('Get the current status'), target resource ('a WeMo device'), and scope ('current state and information'). It distinguishes this tool from siblings like 'list_devices' (which lists multiple devices) and 'control_device' (which changes state rather than retrieving it).

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

Usage Guidelines4/5

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

The description provides clear context about when to use ('device must have been discovered via scan_network first'), which is a prerequisite. However, it doesn't explicitly mention when NOT to use this tool or name specific alternatives among the sibling tools, such as when to use 'list_devices' instead for broader discovery.

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/apiarya/wemo-mcp-server'

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