Skip to main content
Glama
madorn
by madorn

get_device_state

Retrieve the current operational status of a Bond Bridge smart home device, including power state, speed, and direction settings.

Instructions

Get current state of a Bond device.

Args: device_id: The Bond device identifier

Returns: Current device state including power, speed, direction, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The FastMCP tool handler for 'get_device_state', registered via @mcp.tool(). It creates a BondClient instance, calls get_device_state on it, and returns the state wrapped with the device_id or an error.
    @mcp.tool()
    async def get_device_state(device_id: str) -> Dict[str, Any]:
        """Get current state of a Bond device.
        
        Args:
            device_id: The Bond device identifier
            
        Returns:
            Current device state including power, speed, direction, etc.
        """
        try:
            async with await get_bond_client() as client:
                state = await client.get_device_state(device_id)
                return {
                    "device_id": device_id,
                    "state": state
                }
        except BondAPIError as e:
            return {"error": f"Failed to get device state: {str(e)}"}
        except Exception as e:
            logger.error(f"Unexpected error getting device state: {e}")
            return {"error": f"Unexpected error: {str(e)}"}
  • BondClient helper method that performs the actual HTTP GET request to the Bond Bridge API endpoint /v2/devices/{device_id}/state to retrieve the raw device state.
    async def get_device_state(self, device_id: str) -> Dict[str, Any]:
        """Get current state of a device.
        
        Args:
            device_id: Device identifier
            
        Returns:
            Device state
        """
        return await self._request("GET", f"devices/{device_id}/state")
  • Pydantic model defining the structure and validation for Bond device states, relevant to the output of get_device_state.
    class DeviceState(BaseModel):
        """Device state model."""
        power: Optional[int] = None  # 0 = off, 1 = on
        speed: Optional[int] = None  # Fan speed (0-8)
        direction: Optional[int] = None  # Fan direction (1 = forward, -1 = reverse)
        brightness: Optional[int] = None  # Light brightness (0-100)
        position: Optional[int] = None  # Shade position (0-100)
        timer: Optional[int] = None  # Timer in seconds
        
        @validator('speed')
        def validate_speed(cls, v):
            if v is not None and not (0 <= v <= 8):
                raise ValueError('Speed must be between 0 and 8')
            return v
        
        @validator('brightness', 'position')
        def validate_percentage(cls, v):
            if v is not None and not (0 <= v <= 100):
                raise ValueError('Value must be between 0 and 100')
            return v
        
        @validator('direction')
        def validate_direction(cls, v):
            if v is not None and v not in [-1, 1]:
                raise ValueError('Direction must be -1 (reverse) or 1 (forward)')
            return v
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states this is a 'Get' operation, implying read-only behavior, but doesn't mention permissions, rate limits, error conditions, or whether it's idempotent. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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, an 'Args' section, and a 'Returns' section, making it easy to parse. It's appropriately sized for a simple tool, though the 'Returns' part could be slightly more detailed to enhance clarity without adding bulk.

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 low complexity (one parameter) and the presence of an output schema, the description is adequate but minimal. It covers the basics but lacks depth in usage guidelines and behavioral context, which are important for an agent to operate effectively without annotations.

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 description adds meaningful context beyond the input schema: it explains that 'device_id' is a 'Bond device identifier,' which clarifies the parameter's purpose. With 0% schema description coverage and only one parameter, this compensation is effective, though it could specify format or constraints.

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 verb 'Get' and resource 'current state of a Bond device', making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_device_info' or 'list_devices', 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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get_device_info' and 'list_devices', there's no indication of how this tool differs in usage context, leaving the agent without direction on tool selection.

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