disconnect_ur
Disconnect a Universal Robot by specifying its IP address using the nUR MCP Server tool. Manage robot connections directly through natural language commands for efficient control and monitoring.
Instructions
根据用户提供的IP,断开与UR机器人的连接 IP:机器人地址
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes |
Implementation Reference
- The handler function for the 'disconnect_ur' tool. It is decorated with @mcp.tool(), which registers it as an MCP tool. The function takes an IP string, checks if the connection exists in robot_list, closes it if so, and returns a JSON message indicating success or failure.@mcp.tool() def disconnect_ur(ip: str): """根据用户提供的IP,断开与UR机器人的连接 IP:机器人地址""" try: if robot_list.get(ip, "unknown") == "unknown": return return_msg("连接不存在") robot_list[ip].close() return return_msg("连接已断开。") except Exception as e: logger.error(f"连接断开失败: {str(e)}") return return_msg(f"连接断开失败: {str(e)}")
- src/nonead_universal_robots_mcp/server.py:180-180 (registration)The @mcp.tool() decorator registers the disconnect_ur function as an MCP tool.@mcp.tool()
- The function signature (ip: str) and docstring define the input schema for the tool: IP address of the robot.def disconnect_ur(ip: str): """根据用户提供的IP,断开与UR机器人的连接 IP:机器人地址"""