Skip to main content
Glama
sandraschi

Robotics MCP Server

robot_control

Control physical and virtual robots through a unified interface. Perform actions like movement, status checks, emergency stops, and synchronization between robot types.

Instructions

Unified robot control (works for both physical bot and virtual bot).

This portmanteau tool provides a unified interface for controlling both physical robots (via ROS) and virtual robots (via Unity/VRChat). The tool automatically routes commands to the appropriate handler based on robot type.

Args: robot_id: Robot identifier (e.g., "scout_01", "vbot_scout_01"). action: Operation to perform: - "get_status": Get robot status (battery, position, state) - "move": Control movement (linear/angular velocity) - "stop": Emergency stop - "return_to_dock": Return to charging dock (physical bot only) - "stand": Stand up (Unitree G1, physical bot only) - "sit": Sit down (Unitree G1, physical bot only) - "walk": Walking gait (Unitree, physical bot only) - "sync_vbot": Sync virtual bot with physical bot state linear: Linear velocity (m/s) for move action. angular: Angular velocity (rad/s) for move action. duration: Movement duration (seconds). **kwargs: Additional action-specific parameters.

Returns: Dictionary containing operation result.

Examples: Get robot status: result = await robot_control(robot_id="scout_01", action="get_status")

Move robot forward:
    result = await robot_control(
        robot_id="scout_01",
        action="move",
        linear=0.2,
        angular=0.0
    )

Stop robot:
    result = await robot_control(robot_id="scout_01", action="stop")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
robot_idYes
actionYes
linearNo
angularNo
durationNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'robot_control' tool. It handles input parameters, retrieves the robot state, routes to physical or virtual robot handlers, and includes error handling.
    @self.mcp.tool()
    async def robot_control(
        robot_id: str,
        action: Literal[
            "get_status",
            "move",
            "stop",
            "return_to_dock",
            "stand",
            "sit",
            "walk",
            "sync_vbot",
        ],
        linear: Optional[float] = None,
        angular: Optional[float] = None,
        duration: Optional[float] = None,
    ) -> Dict[str, Any]:
        """Unified robot control (works for both physical bot and virtual bot).
    
        This portmanteau tool provides a unified interface for controlling both
        physical robots (via ROS) and virtual robots (via Unity/VRChat). The tool
        automatically routes commands to the appropriate handler based on robot type.
    
        Args:
            robot_id: Robot identifier (e.g., "scout_01", "vbot_scout_01").
            action: Operation to perform:
                - "get_status": Get robot status (battery, position, state)
                - "move": Control movement (linear/angular velocity)
                - "stop": Emergency stop
                - "return_to_dock": Return to charging dock (physical bot only)
                - "stand": Stand up (Unitree G1, physical bot only)
                - "sit": Sit down (Unitree G1, physical bot only)
                - "walk": Walking gait (Unitree, physical bot only)
                - "sync_vbot": Sync virtual bot with physical bot state
            linear: Linear velocity (m/s) for move action.
            angular: Angular velocity (rad/s) for move action.
            duration: Movement duration (seconds).
            **kwargs: Additional action-specific parameters.
    
        Returns:
            Dictionary containing operation result.
    
        Examples:
            Get robot status:
                result = await robot_control(robot_id="scout_01", action="get_status")
    
            Move robot forward:
                result = await robot_control(
                    robot_id="scout_01",
                    action="move",
                    linear=0.2,
                    angular=0.0
                )
    
            Stop robot:
                result = await robot_control(robot_id="scout_01", action="stop")
        """
        try:
            robot = self.state_manager.get_robot(robot_id)
            if not robot:
                return format_error_response(
                    f"Robot {robot_id} not found",
                    error_type="not_found",
                    robot_id=robot_id,
                    action=action,
                )
    
            # Route to appropriate handler
            if robot.is_virtual:
                return await self._handle_virtual_robot(robot, action, linear, angular, duration)
            else:
                return await self._handle_physical_robot(robot, action, linear, angular, duration)
        except Exception as e:
            return handle_tool_error("robot_control", e, robot_id=robot_id, action=action)
  • Input schema defined by type hints and Literal enum for the action parameter, used by MCP for validation.
    async def robot_control(
        robot_id: str,
        action: Literal[
            "get_status",
            "move",
            "stop",
            "return_to_dock",
            "stand",
            "sit",
            "walk",
            "sync_vbot",
        ],
        linear: Optional[float] = None,
        angular: Optional[float] = None,
        duration: Optional[float] = None,
    ) -> Dict[str, Any]:
  • Registration of the robot_control tool instance during server initialization by calling its register() method.
    # Register portmanteau tools
    self.robot_control.register()
    self.virtual_robotics.register()
    self.vbot_crud.register()
  • Helper method for handling commands on physical robots (ROS integration placeholder).
    async def _handle_physical_robot(
        self,
        robot: Any,
        action: str,
        linear: Optional[float],
        angular: Optional[float],
        duration: Optional[float],
    ) -> Dict[str, Any]:
        """Handle physical robot commands.
    
        Args:
            robot: Robot state.
            action: Action to perform.
            linear: Linear velocity.
            angular: Angular velocity.
            duration: Movement duration.
            **kwargs: Additional parameters.
    
        Returns:
            Operation result.
        """
        try:
            # TODO: Implement ROS bridge integration
            logger.info("Physical robot command", robot_id=robot.robot_id, action=action)
            return format_success_response(
                f"Physical robot {action} command sent (mock - ROS integration pending)",
                robot_id=robot.robot_id,
                action=action,
                data={
                    "note": "ROS bridge integration not yet implemented",
                    "mock": True,
                },
            )
        except Exception as e:
            return handle_tool_error("_handle_physical_robot", e, robot_id=robot.robot_id, action=action)
  • Helper method for handling virtual robot commands by proxying to mounted MCP servers (avatar-mcp, unity3d-mcp, vrchat-mcp) using Client.call_tool.
    async def _handle_virtual_robot(
        self,
        robot: Any,
        action: str,
        linear: Optional[float],
        angular: Optional[float],
        duration: Optional[float],
    ) -> Dict[str, Any]:
        """Handle virtual robot commands.
    
        Args:
            robot: Robot state.
            action: Action to perform.
            linear: Linear velocity.
            angular: Angular velocity.
            duration: Movement duration.
            **kwargs: Additional parameters.
    
        Returns:
            Operation result.
        """
        from fastmcp import Client
    
        logger.info("Virtual robot command", robot_id=robot.robot_id, action=action, platform=robot.platform)
    
        try:
            if action == "move":
                if robot.platform == "unity":
                    # Use avatar-mcp or unity3d-mcp for movement
                    async with Client(self.mcp) as client:
                        # Try avatar-mcp first for smooth locomotion
                        try:
                            await client.call_tool(
                                "avatar_movement_walk",
                                avatar_id=robot.robot_id,
                                direction="forward",
                                speed=linear or 0.0,
                            )
                            if angular:
                                await client.call_tool(
                                    "avatar_movement_turn",
                                    avatar_id=robot.robot_id,
                                    angle=angular,
                                )
                            return {
                                "status": "success",
                                "message": f"Virtual robot moved via avatar-mcp",
                                "robot_id": robot.robot_id,
                                "action": action,
                                "linear": linear,
                                "angular": angular,
                            }
                        except Exception:
                            # Fallback to Unity direct control
                            await client.call_tool(
                                "unity_execute_method",
                                class_name="RobotController",
                                method_name="Move",
                                parameters={
                                    "robotId": robot.robot_id,
                                    "linear": linear or 0.0,
                                    "angular": angular or 0.0,
                                },
                            )
                            return {
                                "status": "success",
                                "message": f"Virtual robot moved via Unity",
                                "robot_id": robot.robot_id,
                                "action": action,
                            }
                elif robot.platform == "vrchat":
                    # Use VRChat OSC for movement
                    async with Client(self.mcp) as client:
                        await client.call_tool(
                            "vrchat_send_osc_message",
                            address=f"/robot/{robot.robot_id}/move",
                            args=[linear or 0.0, angular or 0.0],
                        )
                        return {
                            "status": "success",
                            "message": f"Virtual robot moved via VRChat OSC",
                            "robot_id": robot.robot_id,
                            "action": action,
                        }
    
            elif action == "stop":
                async with Client(self.mcp) as client:
                    if robot.platform == "vrchat":
                        await client.call_tool(
                            "vrchat_send_osc_message",
                            address=f"/robot/{robot.robot_id}/stop",
                            args=[1],
                        )
                    else:
                        await client.call_tool(
                            "avatar_movement_walk",
                            avatar_id=robot.robot_id,
                            direction="forward",
                            speed=0.0,
                        )
                    return {
                        "status": "success",
                        "message": f"Virtual robot stopped",
                        "robot_id": robot.robot_id,
                        "action": action,
                    }
    
            elif action == "get_status":
                return {
                    "status": "success",
                    "robot": robot.to_dict(),
                    "action": action,
                }
    
            else:
                return {
                    "status": "success",
                    "message": f"Virtual robot {action} command sent",
                    "robot_id": robot.robot_id,
                    "action": action,
                }
    
        except Exception as e:
            return handle_tool_error("_handle_virtual_robot", e, robot_id=robot.robot_id, action=action)
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It discloses key behavioral traits: the unified interface concept, automatic routing based on robot type, and action-specific limitations (e.g., 'physical bot only' for certain actions). However, it doesn't cover critical aspects like error handling, authentication requirements, rate limits, or safety implications of emergency stops.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (overview, args, returns, examples) and front-loaded key information. While comprehensive, some sentences could be more concise (e.g., the portmanteau explanation). The examples are helpful but add length.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (5 parameters, 8 action types, dual robot support) and having an output schema (returns dictionary), the description is quite complete. It covers purpose, parameters, usage examples, and behavioral context. The main gap is lack of error/edge case handling information, which would be valuable for a control tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description provides excellent parameter semantics. It explains robot_id format with examples, enumerates and describes all action options with physical/virtual limitations, clarifies linear/angular velocity units and purposes, explains duration parameter, and mentions **kwargs for additional parameters. This fully compensates for the schema coverage gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool provides 'unified robot control' for both physical and virtual robots, specifying it routes commands to appropriate handlers based on robot type. It distinguishes itself from siblings like robot_virtual or vbot_crud by handling both types through a single interface.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool (for controlling both physical and virtual robots) and implicitly suggests alternatives by mentioning robot type routing. However, it doesn't explicitly state when NOT to use it or name specific sibling tools as alternatives for specialized cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/sandraschi/robotics-mcp'

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