closeContainer
Closes the currently open container in Minecraft to manage inventory and continue gameplay.
Instructions
Close the currently open container
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- Handler function that closes the currently open container window and clears the currentContainer state.async () => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { // Check if a container is open if (!botState.currentContainer) { return createSuccessResponse('No container is currently open.') } // Close the container if (botState.bot.currentWindow) { await botState.bot.closeWindow(botState.bot.currentWindow) } botState.currentContainer = null return createSuccessResponse('Container closed successfully.') } catch (error) { return createErrorResponse(error) } }
- src/tools/containerInteraction.ts:236-262 (registration)Registration of the closeContainer tool using server.tool, with empty input schema and the handler function.server.tool( 'closeContainer', 'Close the currently open container', {}, async () => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { // Check if a container is open if (!botState.currentContainer) { return createSuccessResponse('No container is currently open.') } // Close the container if (botState.bot.currentWindow) { await botState.bot.closeWindow(botState.bot.currentWindow) } botState.currentContainer = null return createSuccessResponse('Container closed successfully.') } catch (error) { return createErrorResponse(error) } } )