get_player_info
Get a player's information by providing their name or unique ID to enable efficient player management and monitoring within a cloud network.
Instructions
Get a player by their unique id or name
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| identifier | Yes | The name or unique id of the player |
Implementation Reference
- src/cloudnet_mcp/server.py:60-162 (registration)The list_tools() function registers all available MCP tools including get_player_info (lines 102-112) with its input schema defining a required 'identifier' parameter.
@app.list_tools() async def list_tools() -> list[types.Tool]: return [ types.Tool( name="get_nodes", description="List all nodes in the CloudNet cluster", inputSchema={ "type": "object", "properties": {}, }, ), types.Tool( name="get_node_info", description="Get detailed information about a specific node", inputSchema={ "type": "object", "properties": { "node_id": {"type": "string", "description": "The ID of the node"} }, "required": ["node_id"], }, ), types.Tool( name="get_services", description="List all smart services", inputSchema={ "type": "object", "properties": {}, }, ), 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"}, }, }, ), types.Tool( name="get_player_info", description="Get a player by their unique id or name", inputSchema={ "type": "object", "properties": { "identifier": {"type": "string", "description": "The name or unique id of the player"} }, "required": ["identifier"], }, ), types.Tool( name="kick_player", description="Kicks a given player from the entire network", inputSchema={ "type": "object", "properties": { "identifier": {"type": "string", "description": "The name or unique id of the player"}, "message": {"type": "string", "description": "The kick message/reason"} }, "required": ["identifier", "message"], }, ), types.Tool( name="send_player_message", description="Sends a chat message to a given player", inputSchema={ "type": "object", "properties": { "identifier": {"type": "string", "description": "The name or unique id of the player"}, "message": {"type": "string", "description": "The chat message to send"} }, "required": ["identifier", "message"], }, ), types.Tool( name="execute_player_command", description="Executes a command for a given player", inputSchema={ "type": "object", "properties": { "identifier": {"type": "string", "description": "The name or unique id of the player"}, "command": {"type": "string", "description": "The command to execute (without prefixing slash)"}, "redirectToServer": {"type": "boolean", "description": "Redirect downstream if not found on proxy"} }, "required": ["identifier", "command"], }, ), types.Tool( name="execute_service_command", description="Executes the specified command on a service console", inputSchema={ "type": "object", "properties": { "identifier": {"type": "string", "description": "The name or unique id of the service"}, "command": {"type": "string", "description": "The command to execute on the service"} }, "required": ["identifier", "command"], }, ), ] - src/cloudnet_mcp/server.py:102-112 (schema)The Tool definition for 'get_player_info' specifying the input schema: a required string 'identifier' property (name or unique id of the player).
types.Tool( name="get_player_info", description="Get a player by their unique id or name", inputSchema={ "type": "object", "properties": { "identifier": {"type": "string", "description": "The name or unique id of the player"} }, "required": ["identifier"], }, ), - src/cloudnet_mcp/server.py:164-218 (handler)The call_tool() function is the handler for all tools. For get_player_info (lines 190-193), it extracts the 'identifier' argument and makes a GET request to 'player/online/{identifier}' via the CloudNet API client.
@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))] elif name == "get_player_info": identifier = arguments.get("identifier") data = await client.request("GET", f"player/online/{identifier}") return [types.TextContent(type="text", text=str(data))] elif name == "kick_player": identifier = arguments.get("identifier") msg = arguments.get("message") data = await client.request("POST", f"player/online/{identifier}/kick", json={"kickMessage": msg}) return [types.TextContent(type="text", text=str(data))] elif name == "send_player_message": identifier = arguments.get("identifier") msg = arguments.get("message") data = await client.request("POST", f"player/online/{identifier}/sendChat", json={"chatMessage": msg}) return [types.TextContent(type="text", text=str(data))] elif name == "execute_player_command": identifier = arguments.get("identifier") cmd = arguments.get("command") params = {} if "redirectToServer" in arguments: params["redirectToServer"] = str(arguments["redirectToServer"]).lower() data = await client.request("POST", f"player/online/{identifier}/command", params=params, json={"command": cmd}) return [types.TextContent(type="text", text=str(data))] elif name == "execute_service_command": identifier = arguments.get("identifier") cmd = arguments.get("command") data = await client.request("POST", f"service/{identifier}/command", json={"command": cmd}) return [types.TextContent(type="text", text=str(data))] else: raise ValueError(f"Unknown tool: {name}")