Skip to main content
Glama
aldilaff
by aldilaff

wyze_turn_off_device

Turn off a Wyze smart light device using its MAC address to control lighting remotely through the MCP Wyze Server.

Instructions

Turn off a Wyze light device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_macYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The wyze_turn_off_device tool handler function, decorated with @mcp.tool() for registration in FastMCP. It authenticates with Wyze API, finds the device by MAC address, verifies it's a supported light type, and calls the Wyze SDK's bulbs.turn_off method.
    @mcp.tool()
    def wyze_turn_off_device(device_mac: str) -> Dict[str, str]:
        """Turn off a Wyze light device"""
        try:
            client = get_wyze_client()
            devices = client.devices_list()
            
            for device in devices:
                if device.mac == device_mac:
                    # Get device type - try multiple approaches
                    device_type = (getattr(device, 'product_type', None) or 
                                  getattr(device, 'type', None) or
                                  (hasattr(device, 'product') and getattr(device.product, 'type', None)) or
                                  'Unknown')
                    
                    device_model = (getattr(device, 'product_model', None) or
                                   getattr(device, 'model', None) or
                                   (hasattr(device, 'product') and getattr(device.product, 'model', None)) or
                                   'Unknown')
                    
                    if device_type in ['Light', 'Bulb', 'MeshLight', 'LightStrip']:
                        client.bulbs.turn_off(device_mac=device_mac, device_model=device_model)
                    else:
                        return {"status": "error", "message": f"Device type '{device_type}' is not a supported light device"}
                    
                    return {"status": "success", "message": f"Device {device.nickname} turned off"}
            
            return {"status": "error", "message": f"Device with MAC {device_mac} not found"}
        except WyzeClientConfigurationError as e:
            return {"status": "error", "message": f"Configuration error: {str(e)}"}
        except WyzeRequestError as e:
            return {"status": "error", "message": f"API error: {str(e)}"}
        except Exception as e:
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}
  • Helper function to initialize and return the Wyze SDK Client instance using environment variables for authentication. Used by all Wyze tool handlers including wyze_turn_off_device.
    def get_wyze_client() -> Client:
        """Get or create Wyze client instance with auto-login if credentials available"""
        global _wyze_client
        
        if _wyze_client is None:
            # Get credentials from environment
            email = os.getenv("WYZE_EMAIL")
            password = os.getenv("WYZE_PASSWORD")
            key_id = os.getenv("WYZE_KEY_ID")
            api_key = os.getenv("WYZE_API_KEY")
            
            if not all([email, password, key_id, api_key]):
                raise WyzeClientConfigurationError(
                    "Missing required environment variables: WYZE_EMAIL, WYZE_PASSWORD, WYZE_KEY_ID, WYZE_API_KEY"
                )
            
            _wyze_client = Client(
                email=email,
                password=password,
                key_id=key_id,
                api_key=api_key
            )
        
        return _wyze_client
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic action. It doesn't disclose whether this requires authentication (implied by sibling 'wyze_login'), potential rate limits, network dependencies, error conditions, or what 'off' means behaviorally (e.g., power state vs. software control). This is inadequate for a mutation tool with zero annotation coverage.

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 a single, efficient sentence that gets straight to the point with no wasted words. It's appropriately sized for a simple action tool and front-loads the essential information.

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 simplicity (one parameter, mutation action) and the presence of an output schema (which handles return values), the description is minimally adequate. However, with no annotations and incomplete parameter documentation, it leaves gaps in behavioral understanding that could affect reliable tool invocation.

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 mentions no parameters, while the schema has one parameter (device_mac) with 0% description coverage. Since the description doesn't add any parameter information, it doesn't compensate for the schema gap. However, with only one parameter and the tool name implying its purpose, a baseline score of 3 is appropriate as the agent can infer the parameter's role from context.

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 action ('turn off') and target resource ('a Wyze light device'), making the purpose immediately understandable. However, it doesn't differentiate from the sibling tool 'wyze_turn_on_device' beyond the obvious on/off distinction, which prevents a perfect score.

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 about when to use this tool versus alternatives like 'wyze_set_brightness' (which could dim to zero) or 'wyze_set_light_effect' (which might include off states). The description assumes the agent knows this is the primary off command without context about prerequisites or exclusions.

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/aldilaff/mcp-wyze-server'

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