list_robot_commands
Retrieve historical commands sent to a GS cleaning robot by serial number to monitor robot activities and track past operations.
Instructions
Lists historical commands sent to a robot.
Args:
serial_number: The serial number of the target robot.
page: Page number (default: 1).
page_size: Number of items per page (default: 10).
Returns:
A dictionary containing the historical commands list.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serial_number | Yes | ||
| page | No | ||
| page_size | No |
Implementation Reference
- src/gs_openapi/main.py:159-171 (handler)MCP tool handler function for list_robot_commands, decorated with @mcp.tool() for registration and execution, delegates to GausiumMCP instance.@mcp.tool() async def list_robot_commands(serial_number: str, page: int = 1, page_size: int = 10): """Lists historical commands sent to a robot. Args: serial_number: The serial number of the target robot. page: Page number (default: 1). page_size: Number of items per page (default: 10). Returns: A dictionary containing the historical commands list. """ return await mcp.list_robot_commands(serial_number=serial_number, page=page, page_size=page_size)
- Core handler implementation in GausiumMCP class that performs the API call to list robot commands using GausiumAPIClient.async def list_robot_commands( self, serial_number: str, page: int = 1, page_size: int = 10 ) -> Dict[str, Any]: """ 获取机器人历史发出指令。 Args: serial_number: 机器人序列号 page: 页码,默认1 page_size: 每页数量,默认10 Returns: 历史指令列表 Raises: ValueError: 序列号为空 httpx.HTTPStatusError: API调用错误 httpx.RequestError: 网络问题 """ if not serial_number: raise ValueError("Serial number cannot be empty") async with GausiumAPIClient() as client: return await client.call_endpoint( 'list_commands', path_params={'serial_number': serial_number}, query_params={ 'page': page, 'pageSize': page_size } )
- API endpoint configuration defining the path, method, and name for the list_commands endpoint used by the client.'list_commands': APIEndpoint( name="list_robot_commands", path="robots/{serial_number}/commands", method=HTTPMethod.GET, version=APIVersion.V1_ALPHA1, description="获取机器人历史发出指令" )