get_map_subareas
Retrieve detailed subarea information from robot maps to enable precise zone control and targeted cleaning operations.
Instructions
Gets map subareas information for precise area control.
Args:
map_id: The ID of the target map.
Returns:
A dictionary containing map subareas information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| map_id | Yes |
Implementation Reference
- src/gs_openapi/main.py:106-116 (handler)MCP tool handler for get_map_subareas, decorated with @mcp.tool() and delegates to the core GausiumMCP method.@mcp.tool() async def get_map_subareas(map_id: str): """Gets map subareas information for precise area control. Args: map_id: The ID of the target map. Returns: A dictionary containing map subareas information. """ return await mcp.get_map_subareas(map_id=map_id)
- Core handler logic in GausiumMCP class that validates input, builds the API request payload, and calls the Gausium API endpoint for retrieving map subareas.async def get_map_subareas(self, map_id: str, robot_sn: str = None) -> Dict[str, Any]: """ 获取地图分区信息。 Args: map_id: 地图ID robot_sn: 机器人序列号 (某些API版本需要) Returns: 地图分区详细信息 Raises: ValueError: map_id为空 httpx.HTTPStatusError: API调用错误 httpx.RequestError: 网络问题 """ if not map_id: raise ValueError("Map ID cannot be empty") # 构建请求体 request_data = {"mapId": map_id} if robot_sn: request_data["robotSn"] = robot_sn async with GausiumAPIClient() as client: return await client.call_endpoint( 'get_map_subareas', json_data=request_data )
- src/gs_openapi/main.py:106-116 (registration)Registration of the get_map_subareas tool using @mcp.tool() decorator in the main MCP server file.@mcp.tool() async def get_map_subareas(map_id: str): """Gets map subareas information for precise area control. Args: map_id: The ID of the target map. Returns: A dictionary containing map subareas information. """ return await mcp.get_map_subareas(map_id=map_id)
- API endpoint configuration defining the path, method, version, and other details for the underlying Gausium API call used by the tool.'get_map_subareas': APIEndpoint( name="get_map_subareas", path="map/subareas/get", method=HTTPMethod.POST, version=APIVersion.OPENAPI_V1, description="查询机器人地图分区" ),