Skip to main content
Glama
madorn
by madorn

send_custom_action

Control Bond smart home devices by sending custom actions like TurnOn, TurnOff, or SetSpeed to specific devices through the Bond MCP Server.

Instructions

Send a custom action to a Bond device.

Args: device_id: The Bond device identifier action: Bond action name (e.g., "TurnOn", "TurnOff", "SetSpeed") argument: Optional argument for the action

Returns: Result of the custom action.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_idYes
actionYes
argumentNo

Implementation Reference

  • The handler function for the 'send_custom_action' tool, registered via @mcp.tool(). It sends a custom action to a Bond device using the BondClient, handling errors and returning results.
    @mcp.tool()
    async def send_custom_action(device_id: str, action: str, argument: Optional[int] = None) -> Dict[str, Any]:
        """Send a custom action to a Bond device.
        
        Args:
            device_id: The Bond device identifier
            action: Bond action name (e.g., "TurnOn", "TurnOff", "SetSpeed")
            argument: Optional argument for the action
            
        Returns:
            Result of the custom action.
        """
        try:
            async with await get_bond_client() as client:
                result = await client.send_action(device_id, action, argument)
                return {
                    "device_id": device_id,
                    "action": action,
                    "argument": argument,
                    "result": result
                }
        except BondAPIError as e:
            return {"error": f"Failed to send custom action: {str(e)}"}
        except Exception as e:
            logger.error(f"Unexpected error sending custom action: {e}")
            return {"error": f"Unexpected error: {str(e)}"}

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