list_robots
Retrieve a paginated list of GS cleaning robots with optional filtering by relation type to monitor and manage robot fleets.
Instructions
Fetches the list of robots from the Gausium OpenAPI.
Based on: https://developer.gs-robot.com/zh_CN/Robot%20Information%20Service/List%20Robots
Args:
page: The page number to retrieve (must be > 0).
page_size: The number of items per page.
relation: Optional relation type (e.g., 'contract').
Returns:
A dictionary containing the robot list data from the API.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | ||
| page_size | No | ||
| relation | No |
Implementation Reference
- src/gs_openapi/main.py:31-45 (handler)Primary MCP tool handler for 'list_robots'. Registered with @mcp.tool() decorator. Defines input parameters and docstring for schema. Delegates execution to GausiumMCP.list_robots method.@mcp.tool() async def list_robots(page: int = 1, page_size: int = 10, relation: str = None): """Fetches the list of robots from the Gausium OpenAPI. Based on: https://developer.gs-robot.com/zh_CN/Robot%20Information%20Service/List%20Robots Args: page: The page number to retrieve (must be > 0). page_size: The number of items per page. relation: Optional relation type (e.g., 'contract'). Returns: A dictionary containing the robot list data from the API. """ return await mcp.list_robots(page=page, page_size=page_size, relation=relation)
- Core implementation logic for listing robots. Builds query parameters and invokes GausiumAPIClient.call_endpoint('list_robots') to perform the actual API request.async def list_robots( self, page: int = 1, page_size: int = 10, relation: Optional[str] = None ) -> Dict[str, Any]: """ 获取机器人列表。 Args: page: 页码 (必须 > 0) page_size: 每页数量 relation: 可选关系类型 (例如 'contract') Returns: 包含机器人列表数据的字典 Raises: httpx.HTTPStatusError: API调用返回错误状态码 httpx.RequestError: 网络连接问题 """ query_params = { "page": page, "pageSize": page_size, } if relation is not None: query_params["relation"] = relation async with GausiumAPIClient() as client: return await client.call_endpoint( 'list_robots', query_params=query_params )
- API endpoint schema/configuration definition for the 'list_robots' endpoint, specifying path, method, version, used by the API client.'list_robots': APIEndpoint( name="list_robots", path="robots", method=HTTPMethod.GET, version=APIVersion.V1_ALPHA1, description="列出机器人"