get_robot_mode
Retrieve the operational status of a Universal Robots collaborative robot by providing its IP address to monitor or verify its current working mode.
Instructions
获取指定IP机器人的运行状态 IP:机器人地址
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes |
Implementation Reference
- The main handler function for the MCP tool 'get_robot_mode'. It checks the robot connection, calls ur_robotmode() on the DashboardClient to get the robot mode, logs the result, and returns a formatted message. The @mcp.tool() decorator registers this function as an MCP tool.@mcp.tool() def get_robot_mode(ip: str): """获取指定IP机器人的运行状态 IP:机器人地址""" try: if '连接失败' in link_check(ip): return return_msg(f"与机器人的连接已断开。") robot_list[ip].robotConnector.DashboardClient.ur_robotmode() logger.info(f"IP为{ip}的优傲机器人的运行状态为: {robot_list[ip].robotConnector.DashboardClient.last_respond}") return return_msg( f"IP为{ip}的优傲机器人的运行状态为: {robot_list[ip].robotConnector.DashboardClient.last_respond}") except Exception as e: logger.error(f"运行状态获取失败: {str(e)}") return return_msg(f"运行状态获取失败: {str(e)}")