list_robot_commands
Retrieve and view historical commands sent to a GS cleaning robot by serial number, with pagination support for managing command history.
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 for 'list_robot_commands'. This decorated function is the entry point invoked by the MCP server when the tool is called. It delegates to the underlying 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 helper method implementing the list_robot_commands logic in the GausiumMCP class. Uses GausiumAPIClient to call the 'list_commands' API endpoint.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 } )
- src/gs_openapi/main.py:159-171 (registration)Registration of the MCP tool via @mcp.tool() decorator, which registers the handler with the MCP server.@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)
- API endpoint configuration for 'list_commands' used by the GausiumAPIClient, with name 'list_robot_commands'.'list_commands': APIEndpoint( name="list_robot_commands", path="robots/{serial_number}/commands", method=HTTPMethod.GET, version=APIVersion.V1_ALPHA1, description="获取机器人历史发出指令" )