get_online_players
Retrieve a list of online players with options to limit results, skip entries, and sort by name. Query the CloudNet server to filter player data based on your criteria.
Instructions
Get a list of online players based on the query parameters
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | The maximum amount of players to respond with | |
| skip | No | The amount of players to skip | |
| sort | No | Sort players by name |
Implementation Reference
- src/cloudnet_mcp/server.py:90-101 (registration)Tool registration: defines 'get_online_players' with input schema including optional limit, skip, and sort parameters.
types.Tool( name="get_online_players", description="Get a list of online players based on the query parameters", inputSchema={ "type": "object", "properties": { "limit": {"type": "integer", "description": "The maximum amount of players to respond with"}, "skip": {"type": "integer", "description": "The amount of players to skip"}, "sort": {"type": "string", "enum": ["asc", "desc"], "description": "Sort players by name"}, }, }, ), - src/cloudnet_mcp/server.py:164-189 (handler)Handler implementation: extracts limit/skip/sort params from arguments, calls GET /player/online via the API client, and returns results as text.
@app.call_tool() async def call_tool( name: str, arguments: dict[str, Any] | None ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: if arguments is None: arguments = {} if name == "get_nodes": data = await client.request("GET", "node") return [types.TextContent(type="text", text=str(data))] elif name == "get_node_info": node_id = arguments.get("node_id") if not node_id: raise ValueError("node_id is required") data = await client.request("GET", f"node/{node_id}") return [types.TextContent(type="text", text=str(data))] elif name == "get_services": data = await client.request("GET", "service") return [types.TextContent(type="text", text=str(data))] elif name == "get_online_players": params = {} for key in ["limit", "skip", "sort"]: if key in arguments: params[key] = arguments[key] data = await client.request("GET", "player/online", params=params) return [types.TextContent(type="text", text=str(data))]