Skip to main content
Glama
nonead

nUR MCP Server

by nonead

movel_x

Control robot movement by specifying TCP motion along the X-axis. Provide robot IP address and distance in meters to execute precise linear movement commands for industrial automation.

Instructions

命令指定IP机器人的TCP沿X轴方向移动 IP:机器人地址 distance:移动距离(米)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYes
distanceYes

Implementation Reference

  • The handler function for the 'movel_x' MCP tool. It connects to the UR robot via IP, retrieves current TCP pose, adjusts the X coordinate by the given distance, executes movel command, confirms completion using movelConfirm helper, and logs/generates a script representation of the command.
    @mcp.tool()
    def movel_x(ip: str, distance: float):
        """命令指定IP机器人的TCP沿X轴方向移动
        IP:机器人地址
        distance:移动距离(米)"""
        try:
            if '连接失败' in link_check(ip):
                return return_msg(f"与机器人的连接已断开。")
            pose = robot_list[ip].get_actual_tcp_pose()
            pose[0] = pose[0] + distance
            robot_list[ip].movel(pose)
            time.sleep(1)
            result = movelConfirm(ip, pose)
            cmd = (f"def my_program():\n"
                   f"  movel(p[{'{:.4f}'.format(pose[0])},{'{:.4f}'.format(pose[1])},{'{:.4f}'.format(pose[2])},{'{:.4f}'.format(pose[3])},{'{:.4f}'.format(pose[4])},{'{:.4f}'.format(pose[5])},],0.5,0.25,0,0)\n"
                   f"end\nmy_program()")
            logger.info(f"发送脚本:{cmd}")
            if result == 1:
                return return_msg(f"命令 {cmd} 已发送,移动完成。")
            else:
                return return_msg(f"命令 {cmd} 已发送,移动失败。")
        except Exception as e:
            logger.error(f"移动失败: {str(e)}")
            return return_msg(f"移动失败: {str(e)}")
  • The @mcp.tool() decorator registers the movel_x function as an MCP tool, using the function name 'movel_x' and its type hints/docstring for schema.
    @mcp.tool()
  • Helper function movelConfirm used by movel_x to verify if the linear move has completed successfully within position tolerance.
    def movelConfirm(ip, pose):
        """
        movel移动的结果确认
        1:移动到位
        2:移动结束,但是位置不准确
        """
        loop_flg = True
        count = 0
        while loop_flg:
            time.sleep(1)
            current_pose = round_pose(robot_list[ip].get_actual_tcp_pose())
            if right_pose_tcp(current_pose, pose):
                robot_list[ip].robotConnector.DashboardClient.ur_running()
                running = robot_list[ip].robotConnector.DashboardClient.last_respond
                if running == 'Program running: false':
                    return 1
            else:
                robot_list[ip].robotConnector.DashboardClient.ur_running()
                running = robot_list[ip].robotConnector.DashboardClient.last_respond
    
                if running == 'Program running: true':
                    '''尚未移动完成'''
                    continue
                else:
                    '''移动完成'''
                    count = count + 1
                    if count > 5:
                        return 2
  • Helper function round_pose used indirectly via movelConfirm to round pose coordinates for comparison.
    def round_pose(pose):
        """给坐标取近似值,精确到三位小数"""
        pose[0] = round(pose[0], 3)
        pose[1] = round(pose[1], 3)
        pose[2] = round(pose[2], 3)
        pose[3] = round(pose[3], 3)
        pose[4] = round(pose[4], 3)
        pose[5] = round(pose[5], 3)
        return pose
  • Helper function right_pose_tcp used by movelConfirm to check if actual TCP pose matches target within 10mm tolerance.
    def right_pose_tcp(current_pose_1, pose):
        """tcp位置是否一致的校验,这里允许10mm的误差"""
        if pose[0] + 0.010 >= current_pose_1[0] >= pose[0] - 0.010:
            if pose[1] + 0.010 >= current_pose_1[1] >= pose[1] - 0.010:
                if pose[2] + 0.010 >= current_pose_1[2] >= pose[2] - 0.010:
                    return True
    
        return False
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the action ('移动' - move) but doesn't describe whether this is a blocking/non-blocking operation, safety considerations, error conditions, or what happens if the robot is not ready. For a motion control tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise—two sentences that directly explain the tool's purpose and parameters. It's front-loaded with the main action. However, the brevity comes at the cost of completeness, as it lacks important contextual information for a motion control tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of robot motion control, no annotations, no output schema, and only basic parameter explanations, the description is incomplete. It doesn't cover behavioral aspects like execution timing, safety, error handling, or relationship to other movement commands. For a tool that physically moves a robot, this level of documentation is inadequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds basic meaning for both parameters: 'IP:机器人地址' (IP: robot address) and 'distance:移动距离(米)' (distance: movement distance in meters). With 0% schema description coverage, this compensates somewhat by explaining what each parameter represents. However, it doesn't provide format details (e.g., IP format, distance limits/sign conventions) or additional context beyond the minimal definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '命令指定IP机器人的TCP沿X轴方向移动' (command the robot at the specified IP to move its TCP along the X-axis). It specifies the verb ('移动' - move), resource ('机器人' - robot), and direction ('X轴方向' - X-axis), which distinguishes it from siblings like movel_y and movel_z. However, it doesn't explicitly differentiate from generic 'movel' or explain what 'TCP' means in this context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose movel_x over movel, movel_y, movel_z, movej, or other movement tools, nor does it specify prerequisites like needing a connected robot or appropriate robot mode. The context is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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