get_output_int_register
Retrieve the integer register value from a Universal Robot by specifying its IP address and register index (0-23).
Instructions
获取指定IP机器人Int寄存器的值, IP:机器人地址 index:寄存器下标,范围是[0,23]
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes | ||
| index | Yes |
Implementation Reference
- The MCP tool handler that retrieves the value of an integer output register from a UR robot. It checks connection, calls robotModle_list[ip].OutputIntRegister(index), and returns the result.
@mcp.tool() def get_output_int_register(ip: str, index: int): """获取指定IP机器人Int寄存器的值, IP:机器人地址 index:寄存器下标,范围是[0,23]""" try: if '连接失败' in link_check(ip): return return_msg(f"与机器人的连接已断开。") logger.info(f"{robotModle_list[ip].OutputIntRegister(index)}") return return_msg(f"Int寄存器{index}={robotModle_list[ip].OutputIntRegister(index)}") except Exception as e: logger.error(f"Int寄存器的值获取失败: {str(e)}") return return_msg(f"Int寄存器的值获取失败: {str(e)}") - src/nonead_universal_robots_mcp/server.py:386-386 (registration)The @mcp.tool() decorator registers 'get_output_int_register' as an MCP tool.
@mcp.tool() - URBasic/robotModel.py:343-345 (helper)Helper method on RobotModel that returns the output int register value from the data dictionary by constructing the key 'output_int_register_{index}'.
def OutputIntRegister(self, index): address = f"output_int_register_{index}" return self.dataDir[address]