Skip to main content
Glama
aldilaff
by aldilaff

wyze_set_brightness

Adjust Wyze smart light brightness levels from 0 to 100 percent using device MAC address for precise lighting control.

Instructions

Set brightness for a Wyze light (0-100)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_macYes
brightnessYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'wyze_set_brightness' tool, decorated with @mcp.tool() for automatic registration. Validates input brightness (0-100), retrieves Wyze client, finds device by MAC, confirms light type support, and executes brightness adjustment via wyze-sdk's bulbs.set_brightness method. Handles various errors gracefully.
    @mcp.tool()
    def wyze_set_brightness(device_mac: str, brightness: int) -> Dict[str, str]:
        """Set brightness for a Wyze light (0-100)"""
        try:
            if not 0 <= brightness <= 100:
                return {"status": "error", "message": "Brightness must be between 0 and 100"}
            
            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.set_brightness(
                            device_mac=device_mac, 
                            device_model=device_model, 
                            brightness=brightness
                        )
                        return {"status": "success", "message": f"Set {device.nickname} brightness to {brightness}%"}
                    else:
                        return {"status": "error", "message": f"Device {device.nickname} does not support brightness control"}
            
            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 lazily initialize and retrieve the global Wyze SDK Client instance, using environment variables for authentication. Essential for all Wyze API calls in the tools.
    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 for behavioral disclosure. It states the action ('Set brightness') which implies a write/mutation operation, but doesn't mention permissions, side effects (e.g., if device must be online), error handling, or response format. The range '0-100' is useful but basic; more context on what happens at extremes or typical values would help.

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 front-loads the core action and includes essential constraint information. Every word earns its place with no redundancy or fluff, making it easy to parse quickly.

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 has an output schema (which handles return values), no annotations, and low complexity, the description is minimally adequate but has gaps. It covers the basic purpose and brightness range, but lacks parameter details for device_mac, usage context, and behavioral traits like error conditions. For a mutation tool with 0% schema coverage, it should do more to be fully complete.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It only addresses the 'brightness' parameter with its range ('0-100'), but provides no information about 'device_mac' (e.g., format, how to obtain it, or its role). This leaves half the parameters undocumented, failing to compensate for the schema gap.

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 ('Set brightness') and target resource ('for a Wyze light'), with a specific range constraint ('0-100'). It distinguishes from siblings like wyze_set_color or wyze_turn_on_device by focusing on brightness adjustment. However, it doesn't explicitly differentiate from all siblings (e.g., wyze_set_light_effect might also affect brightness indirectly).

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. The description doesn't mention prerequisites (e.g., device must be on or connected), compare to wyze_turn_on_device (which might set brightness), or indicate when brightness adjustment is appropriate versus color/temperature changes. Usage context is implied but not stated.

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