Skip to main content
Glama

get_device_list

Retrieve a list of connected Ecovacs robot vacuums to identify available devices for cleaning, charging, or status monitoring tasks.

Instructions

Query robot list

Returns: Dict: Dictionary containing list of robot nicknames

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function implementing the 'get_device_list' tool logic. Decorated with @mcp.tool() for registration in the MCP server. Calls the shared call_api helper with the specific device list endpoint to retrieve the list of devices.
    @mcp.tool() async def get_device_list() -> dict: """ Query robot list Returns: Dict: Dictionary containing list of robot nicknames """ return await call_api(ENDPOINT_ROBOT_DEVICE_LIST, {}, method='get')
  • Helper constant defining the API endpoint specifically used by the get_device_list tool.
    ENDPOINT_ROBOT_DEVICE_LIST = "robot/deviceList"
  • Shared helper function used by get_device_list (and other tools) to make authenticated HTTP requests to the Ecovacs API.
    async def call_api(endpoint: str, params: dict, method: str = 'post') -> dict: """ General API call function Args: endpoint: API endpoint params: Request parameters method: Request method, 'get' or 'post' Returns: Dict: API response result, format {"msg": "OK", "code": 0, "data": [...]} """ # Build complete URL url = f"{API_URL}/{endpoint}" # Ensure all parameters are strings params = {k: str(v) for k, v in params.items()} # Add API key if API_KEY: params.update({"ak": API_KEY}) try: async with httpx.AsyncClient() as client: headers = {"Content-Type": "application/json"} if method.lower() == 'get': response = await client.get(url, params=params, timeout=REQUEST_TIMEOUT) else: response = await client.post(url, json=params, headers=headers, timeout=REQUEST_TIMEOUT) response.raise_for_status() return response.json() except Exception as e: # Return unified error format when an error occurs return {"msg": f"Request failed: {str(e)}", "code": -1, "data": []}
  • The @mcp.tool() decorator registers the get_device_list function as an MCP tool in the FastMCP server.
    @mcp.tool()

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/ecovacs-ai/ecovacs-mcp'

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