Skip to main content
Glama
cfrs2005

GS Robot MCP Server

by cfrs2005

create_robot_command

Send commands to GS cleaning robots to start, pause, or stop tasks by specifying robot serial number and command type with optional parameters.

Instructions

Creates a robot command.

Based on: https://developer.gs-robot.com/zh_CN/Robot%20Command%20Service/Create%20Robot%20Command

Args:
    serial_number: The serial number of the target robot.
    command_type: The type of command (e.g., 'START_TASK', 'PAUSE_TASK', 'STOP_TASK').
    command_parameter: Optional command parameters as a dictionary.

Returns:
    A dictionary containing the command creation result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serial_numberYes
command_typeYes
command_parameterNo

Implementation Reference

  • Core handler implementation in GausiumMCP class that validates inputs, constructs the request payload, and calls the Gausium API endpoint 'create_command' via GausiumAPIClient to create the robot command.
    async def create_robot_command(
        self,
        serial_number: str,
        command_type: str,
        command_parameter: Optional[Dict[str, Any]] = None
    ) -> Dict[str, Any]:
        """
        创建机器人指令。
    
        Args:
            serial_number: 机器人序列号
            command_type: 指令类型 (如 'START_TASK', 'PAUSE_TASK', 等)
            command_parameter: 指令参数
    
        Returns:
            指令创建结果
    
        Raises:
            ValueError: 参数无效
            httpx.HTTPStatusError: API调用错误
            httpx.RequestError: 网络问题
        """
        if not serial_number:
            raise ValueError("Serial number cannot be empty")
        if not command_type:
            raise ValueError("Command type cannot be empty")
    
        request_data = {
            "serialNumber": serial_number,
            "remoteTaskCommandType": command_type
        }
        
        if command_parameter:
            request_data["commandParameter"] = command_parameter
    
        async with GausiumAPIClient() as client:
            return await client.call_endpoint(
                'create_command',
                path_params={'serial_number': serial_number},
                json_data=request_data
            )
  • MCP tool registration using @mcp.tool() decorator with a thin wrapper function that delegates to the core GausiumMCP.create_robot_command method.
    # Define create_robot_command tool
    @mcp.tool()
    async def create_robot_command(
        serial_number: str, 
        command_type: str,
        command_parameter: Optional[dict] = None
    ):
        """Creates a robot command.
    
        Based on: https://developer.gs-robot.com/zh_CN/Robot%20Command%20Service/Create%20Robot%20Command
    
        Args:
            serial_number: The serial number of the target robot.
            command_type: The type of command (e.g., 'START_TASK', 'PAUSE_TASK', 'STOP_TASK').
            command_parameter: Optional command parameters as a dictionary.
    
        Returns:
            A dictionary containing the command creation result.
        """
        return await mcp.create_robot_command(
            serial_number=serial_number,
            command_type=command_type,
            command_parameter=command_parameter
        )
  • API endpoint configuration defining the structure (path, method, version) for the 'create_command' endpoint, named 'create_robot_command', used by GausiumAPIClient to make the actual HTTP request.
    'create_command': APIEndpoint(
        name="create_robot_command",
        path="robots/{serial_number}/commands",
        method=HTTPMethod.POST,
        version=APIVersion.V1_ALPHA1,
        description="创建机器人指令"
    ),

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cfrs2005/mcp-gs-robot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server