get_time
Retrieve the uptime in seconds for a specific robot by providing its IP address using the nUR MCP Server control tool.
Instructions
根据用户提供的IP,获取指定机器人的开机时长(秒) IP:机器人地址
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes |
Implementation Reference
- The handler function for the 'get_time' tool, decorated with @mcp.tool() for registration. It checks the connection to the robot at the given IP and returns the robot's uptime in seconds using RobotTimestamp(), formatted to 2 decimal places. Handles errors and connection issues.@mcp.tool() def get_time(ip: str) -> str: """根据用户提供的IP,获取指定机器人的开机时长(秒) IP:机器人地址""" try: if '连接成功' not in link_check(ip): return return_msg(f"与机器人的连接已断开。IP:{ip}") return return_msg(f"{robotModle_list[ip].RobotTimestamp():.2f}") except Exception as e: logger.error(f"获取开机时长失败: {str(e)}") return return_msg(f"获取开机时长失败: {str(e)}")