disconnectFromServer
Terminates the current connection to the Minecraft server, allowing users to safely end remote sessions and exit the game. Useful for managing remote server access and control.
Instructions
Disconnect from the Minecraft server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/connect.ts:103-117 (handler)The handler function for the 'disconnectFromServer' tool. It checks if the bot is connected, quits the bot if so, updates the connection state, and returns appropriate success or error responses.async () => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { botState.bot.quit() updateConnectionState(false, null) return createSuccessResponse( 'Successfully disconnected from the server.' ) } catch (error) { return createErrorResponse(error) } }
- src/tools/connect.ts:99-118 (registration)The registration of the 'disconnectFromServer' tool using server.tool(), specifying the name, description, empty schema (no parameters), and the handler function.server.tool( 'disconnectFromServer', 'Disconnect from the Minecraft server', {}, async () => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { botState.bot.quit() updateConnectionState(false, null) return createSuccessResponse( 'Successfully disconnected from the server.' ) } catch (error) { return createErrorResponse(error) } } )
- src/tools/connect.ts:102-102 (schema)The schema for the 'disconnectFromServer' tool, which is empty as it takes no parameters.{},