get_joint_temperatures
Retrieves the temperature (in Celsius) of each joint from a Universal Robot at a specified IP address.
Instructions
获取指定IP机器人各关节的温度(摄氏度)。 IP:机器人地址
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes |
Implementation Reference
- The main handler function that implements the 'get_joint_temperatures' tool using @mcp.tool() decorator. It checks connection via link_check, then calls robotModle_list[ip].JointTemperatures() to retrieve joint temperatures from the robot model.
@mcp.tool() def get_joint_temperatures(ip: str): """获取指定IP机器人各关节的温度(摄氏度)。 IP:机器人地址""" try: if '连接失败' in link_check(ip): return return_msg(f"与机器人的连接已断开。") logger.info(f"{robotModle_list[ip].JointTemperatures()}(摄氏度)") return return_msg(f"{robotModle_list[ip].JointTemperatures()}(摄氏度)") except Exception as e: logger.error(f"机器人各关节的温度获取失败: {str(e)}") return return_msg(f"机器人各关节的温度获取失败: {str(e)}") - URBasic/robotModel.py:234-235 (schema)Getter method on the RobotModel class that returns the joint_temperatures value from the data dictionary.
def JointTemperatures(self): return self.dataDir['joint_temperatures'] - URBasic/robotModel.py:41-41 (schema)Data field initialization in RobotModel.__init__ where 'joint_temperatures' is defined in the dataDir dictionary.
'joint_temperatures': None, - Helper function used to format return messages as JSON strings.
def return_msg(txt: str): return json.dumps(txt, indent=2, ensure_ascii=False) - src/nonead_universal_robots_mcp/server.py:488-488 (registration)The @mcp.tool() decorator registers this function as an MCP tool named 'get_joint_temperatures'.
@mcp.tool()