get_time
Retrieve robot uptime in seconds by providing an IP address to monitor operational duration for Universal Robots industrial systems.
Instructions
根据用户提供的IP,获取指定机器人的开机时长(秒) IP:机器人地址
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes |
Implementation Reference
- The main handler function for the 'get_time' MCP tool. It is decorated with @mcp.tool(), which registers it and defines its schema from the signature and docstring. The function checks the robot connection via link_check, retrieves the uptime using robotModle_list[ip].RobotTimestamp(), and returns it as a formatted JSON string.@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)}")