execute_player_command
Execute a command for a specific player by providing their identifier and the command. Optionally redirect to a downstream server if the player is not on the proxy.
Instructions
Executes a command for a given player
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| identifier | Yes | The name or unique id of the player | |
| command | Yes | The command to execute (without prefixing slash) | |
| redirectToServer | No | Redirect downstream if not found on proxy |
Implementation Reference
- src/cloudnet_mcp/server.py:137-149 (schema)Input schema definition for 'execute_player_command' tool — expects identifier, command, and optional redirectToServer
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"], }, ), - src/cloudnet_mcp/server.py:204-211 (handler)Handler logic for 'execute_player_command' — extracts identifier, command, and redirectToServer param, then POSTs to CloudNet player/online/{identifier}/command endpoint
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))] - src/cloudnet_mcp/server.py:60-162 (registration)Tool registration via @app.list_tools() decorator — returns all tool definitions including 'execute_player_command'
@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"], }, ), ]