send_program_script
Send a URScript program directly to a Universal Robot cobot at a specified IP address for execution.
Instructions
发送脚本到指定IP的机器人。 IP:机器人地址 script:脚本内容
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes | ||
| script | Yes |
Implementation Reference
- The @mcp.tool() decorated function that implements the 'send_program_script' tool. It accepts 'ip' (robot address) and 'script' (URScript content), checks the connection via link_check, sends the script to the robot via RealTimeClient.SendProgram, and returns a success or failure message.
@mcp.tool() def send_program_script(ip: str, script: str): """发送脚本到指定IP的机器人。 IP:机器人地址 script:脚本内容""" try: if '连接失败' in link_check(ip): return return_msg(f"与机器人的连接已断开。") robot_list[ip].robotConnector.RealTimeClient.SendProgram(script) time.sleep(1) logger.info(f"发送脚本:{script}") return return_msg(f"脚本程序已发送,请确认执行结果。") except Exception as e: logger.error(f"发送脚本失败: {str(e)}") return return_msg(f"发送脚本失败: {str(e)}") - src/nonead_universal_robots_mcp/server.py:534-535 (registration)The @mcp.tool() decorator on the FastMCP instance 'mcp' registers send_program_script as an MCP tool. This is the registration point.
@mcp.tool() def send_program_script(ip: str, script: str):