Skip to main content
Glama
madorn
by madorn

toggle_device_power

Control power for Bond Bridge smart home devices by toggling them on or off using their device identifier.

Instructions

Toggle power state of a Bond device (on/off).

Args: device_id: The Bond device identifier

Returns: Result of the toggle operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The @mcp.tool()-decorated async function that implements the toggle_device_power tool logic: retrieves current device state, toggles power by calling turn_on or turn_off on the BondClient, and returns the result or error.
    @mcp.tool()
    async def toggle_device_power(device_id: str) -> Dict[str, Any]:
        """Toggle power state of a Bond device (on/off).
        
        Args:
            device_id: The Bond device identifier
            
        Returns:
            Result of the toggle operation.
        """
        try:
            async with await get_bond_client() as client:
                # Get current state to determine action
                current_state = await client.get_device_state(device_id)
                power = current_state.get("power", 0)
                
                if power == 1:
                    result = await client.turn_off(device_id)
                    action = "turned off"
                else:
                    result = await client.turn_on(device_id)
                    action = "turned on"
                
                return {
                    "device_id": device_id,
                    "action": action,
                    "result": result
                }
        except BondAPIError as e:
            return {"error": f"Failed to toggle device power: {str(e)}"}
        except Exception as e:
            logger.error(f"Unexpected error toggling device power: {e}")
            return {"error": f"Unexpected error: {str(e)}"}
  • The @mcp.tool() decorator registers the toggle_device_power function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool toggles power (implying a mutation) but doesn't describe side effects (e.g., device response time, error conditions like offline devices), authentication needs, or rate limits. The mention of 'Result of the toggle operation' hints at output but lacks detail, leaving behavioral traits unclear.

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 appropriately sized and front-loaded, with the core purpose stated first. The 'Args' and 'Returns' sections add structure, but the 'Returns' sentence is vague and could be more informative. Overall, it's efficient with little waste, though minor improvements in clarity could enhance it.

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 moderate complexity (mutation with one parameter) and no annotations, the description is somewhat complete but has gaps. It covers the basic action and parameter, and an output schema exists (so return values needn't be detailed). However, it lacks usage context, behavioral details, and parameter constraints, making it adequate but not fully helpful for an agent.

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 minimal meaning beyond the input schema. It defines 'device_id' as 'The Bond device identifier', which is basic but helpful given 0% schema description coverage. However, it doesn't explain format (e.g., string pattern, where to find it) or constraints, so it partially compensates for the coverage gap but not fully.

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 purpose with a specific verb ('Toggle') and resource ('power state of a Bond device'), making it immediately understandable. It distinguishes from siblings like 'control_shades' or 'set_fan_speed' by focusing on power state. However, it doesn't explicitly differentiate from 'get_device_state' which reads rather than toggles power.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., device must be online), exclusions (e.g., not for devices without power control), or comparisons to siblings like 'get_device_state' for checking power or 'send_custom_action' for other operations. Usage is implied but not specified.

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/madorn/bond-mcp-server'

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