get_robot_command
Retrieve execution results for specific robot commands by providing the robot's serial number and command ID to monitor task completion and status.
Instructions
Gets the result of a specific robot command.
Args:
serial_number: The serial number of the target robot.
command_id: The ID of the command to query.
Returns:
A dictionary containing the command execution result.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| serial_number | Yes | ||
| command_id | Yes |
Implementation Reference
- The main handler function in GausiumMCP class that validates inputs and calls the Gausium API endpoint to retrieve the result of a specific robot command.async def get_robot_command( self, serial_number: str, command_id: str ) -> Dict[str, Any]: """ 获取单条指令结果。 Args: serial_number: 机器人序列号 command_id: 指令ID Returns: 指令执行结果 Raises: ValueError: 参数为空 httpx.HTTPStatusError: API调用错误 httpx.RequestError: 网络问题 """ if not serial_number: raise ValueError("Serial number cannot be empty") if not command_id: raise ValueError("Command ID cannot be empty") async with GausiumAPIClient() as client: return await client.call_endpoint( 'get_command', path_params={ 'serial_number': serial_number, 'command_id': command_id } )
- src/gs_openapi/main.py:146-157 (registration)Registers the 'get_robot_command' as an MCP tool using the @mcp.tool() decorator. This defines the tool's interface, docstring for schema, and delegates execution to the mcp instance's method.@mcp.tool() async def get_robot_command(serial_number: str, command_id: str): """Gets the result of a specific robot command. Args: serial_number: The serial number of the target robot. command_id: The ID of the command to query. Returns: A dictionary containing the command execution result. """ return await mcp.get_robot_command(serial_number=serial_number, command_id=command_id)
- Defines the API endpoint configuration for the underlying 'get_command' API, mapping it to the tool name 'get_robot_command' with path parameters and method.'get_command': APIEndpoint( name="get_robot_command", path="robots/{serial_number}/commands/{command_id}", method=HTTPMethod.GET, version=APIVersion.V1_ALPHA1, description="获取单条指令结果" ),