get_robot_status_smart
Auto-detect robot series (M-line V1 or S-line V2) and retrieve its status by serial number.
Instructions
智能获取机器人状态。
自动根据机器人系列选择V1 (M-line) 或V2 (S-line) API。
Args:
serial_number: 机器人序列号
Returns:
机器人状态信息字典Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serial_number | Yes |
Implementation Reference
- src/gs_openapi/main.py:303-315 (registration)MCP tool registration for get_robot_status_smart. Decorated with @mcp.tool(), it delegates to router.get_robot_status_smart.
@mcp.tool() async def get_robot_status_smart(serial_number: str): """智能获取机器人状态。 自动根据机器人系列选择V1 (M-line) 或V2 (S-line) API。 Args: serial_number: 机器人序列号 Returns: 机器人状态信息字典 """ return await router.get_robot_status_smart(serial_number) - Core handler logic in RobotAPIRouter. Determines robot series from serial number prefix, then routes to V1 (M-line) or V2 (S-line) API.
async def get_robot_status_smart(self, serial_number: str) -> Dict[str, Any]: """智能获取机器人状态。 自动根据机器人序列号前缀选择V1或V2 API。 """ # 基于序列号前缀判断机器人系列 detected_series = self._determine_robot_series_from_sn(serial_number) if self.is_s_line_robot(detected_series): # S-line 机器人使用 V2 API result = await self.mcp.get_robot_status_v2(serial_number) result["api_version"] = "V2 (S-line)" result["detected_series"] = detected_series return result else: # M-line 机器人或未知类型默认使用 V1 API result = await self.mcp.get_robot_status_v1(serial_number) result["api_version"] = "V1 (M-line/Default)" result["detected_series"] = detected_series return result - Series mapping schema used by _determine_robot_series_from_sn to classify robots based on serial number prefix.
ROBOT_SERIES_MAPPING = { # M-line 机器人 "GS100": "75", # 75系列 "GS400": "75", # 75系列 (新发现) "GS500": "75", # 75系列 "GS301": "50", # 50系列 "GS401": "50", # 50系列 "GS501": "50", # 50系列 (新发现) "GS442": "40", # 40系列 # S-line 机器人 "GS438": "S", # S系列 "GS408": "S", # S系列 "GS43C": "SW", # SW系列 } - Helper that extracts the 5-char prefix from serial number and looks up the robot series in the mapping.
def _determine_robot_series_from_sn(self, serial_number: str) -> str: """根据序列号前缀判断机器人系列。 Args: serial_number: 机器人序列号 Returns: 机器人系列代码 (40, 50, 75, S, SW) 或 "unknown" """ if len(serial_number) < 5: return "unknown" prefix = serial_number[:5] return self.ROBOT_SERIES_MAPPING.get(prefix, "unknown") def is_m_line_robot(self, model_family_code: str) -> bool: """判断是否为M-line机器人。""" return model_family_code in ["40", "50", "75", "OMNIE"] - Helper that returns True if the model family code indicates an S-line robot.
def is_s_line_robot(self, model_family_code: str) -> bool: """判断是否为S-line机器人。""" return model_family_code in ["S", "SW"]