Skip to main content
Glama

connect_ur

Establish a connection to Universal Robots by providing the robot's IP address in the nUR MCP Server, enabling control and interaction with the robot directly through natural language commands.

Instructions

根据用户提供的IP连接UR IP:机器人地址

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYes

Implementation Reference

  • Handler function for the 'connect_ur' MCP tool. Decorated with @mcp.tool() which registers it. Connects to UR robot using URBasic library, checks remote control mode, manages robot_list global.
    @mcp.tool() def connect_ur(ip: str): """根据用户提供的IP连接UR IP:机器人地址""" try: host = ip global robot_list, robotModle_list if robot_list.get(ip, "unknown") != "unknown": robot_list[ip].robotConnector.close() return return_msg(f"优傲机器人连接失败: {ip}") robotModle = URBasic.robotModel.RobotModel() robot = URBasic.urScriptExt.UrScriptExt(host=host, robotModel=robotModle) robot_list[ip] = robot robotModle_list[ip] = robotModle if robot_list.get(ip, "unknown") == "unknown" or not robot_list[ ip].robotConnector.RTDE.isRunning(): return return_msg(f"优傲机器人连接失败: {ip}") robot_list[ip].robotConnector.DashboardClient.ur_is_remote_control() remote = robot_list[ip].robotConnector.DashboardClient.last_respond.lower() print(f"remote:{remote}") if remote != 'true' and not remote.startswith('could not understand'): disconnect_ur(ip) return return_msg(f"请检查机器人是否处于远程控制模式。IP:{host}") return return_msg(f"连接成功。IP:{host}") except Exception as e: logger.error(f"优傲机器人连接失败: {str(e)}") return return_msg(f"优傲机器人连接失败: {str(e)}")
  • The @mcp.tool() decorator registers the connect_ur function as an MCP tool.
    @mcp.tool()
  • Helper function link_check that calls connect_ur if connection is not active.
    def link_check(ip): """检查连接状态,若连接断开或不存在,则建立连接""" if robot_list.get(ip, "unknown") == "unknown" or not robot_list[ ip].robotConnector.RTDE.isRunning(): return connect_ur(ip) return '连接成功'

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nonead/nUR_MCP_SERVER'

If you have feedback or need assistance with the MCP directory API, please join our Discord server