"""Get status tool for Reachy Mini MCP server."""
from __future__ import annotations
import logging
from typing import Any
from mcp.server.fastmcp import Context, FastMCP
logger = logging.getLogger(__name__)
def register_get_status_tool(mcp: FastMCP) -> None:
"""Register the get_status tool with the MCP server."""
@mcp.tool()
def get_status(ctx: Context) -> dict[str, Any]:
"""Get the current status of the Reachy Mini robot.
Returns information about the robot's connection state, current
movement, queue size, and last commanded pose.
Returns:
Status dict with:
- "connected": Whether the robot is connected
- "queue_size": Number of moves in the queue
- "current_move": Name of the currently playing move (or null)
- "breathing_active": Whether idle breathing is active
- "head_tracking_enabled": Whether head tracking is enabled
- "last_pose": Last commanded pose (head matrix, antennas, body_yaw)
"""
robot_manager = ctx.request_context.lifespan_context.robot_manager
config = ctx.request_context.lifespan_context.config
status = robot_manager.get_status()
return {
"connected": status.connected,
"queue_size": status.queue_size,
"current_move": status.current_move,
"breathing_active": status.breathing_active,
"head_tracking_enabled": status.head_tracking_enabled,
"camera_enabled": config.enable_camera,
"last_pose": status.last_pose,
}