get_time
Retrieve robot uptime in seconds by providing its IP address. This tool helps monitor Universal Robots collaborative robots' operational duration through the nUR MCP Server.
Instructions
根据用户提供的IP,获取指定机器人的开机时长(秒) IP:机器人地址
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes |
Implementation Reference
- The handler function for the 'get_time' MCP tool. It checks the robot connection via link_check, then retrieves and returns the robot's uptime (RobotTimestamp) in seconds for the given IP. Registered via @mcp.tool() decorator. The docstring provides input description and purpose.@mcp.tool() def get_time(ip: str) -> str: """根据用户提供的IP,获取指定机器人的开机时长(秒) IP:机器人地址""" try: if '连接成功' not in link_check(ip): return return_msg(f"与机器人的连接已断开。IP:{ip}") logger.info(f"{robotModle_list[ip].RobotTimestamp():.2f}") return return_msg(f"{robotModle_list[ip].RobotTimestamp():.2f}") except Exception as e: logger.error(f"获取开机时长失败: {str(e)}") return return_msg(f"获取开机时长失败: {str(e)}")