closeContainer
Automates the closing of open containers in Minecraft through remote server commands, streamlining inventory management and interactions.
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 by calling bot.closeWindow and clearing botState.currentContainer.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 via server.tool(), with no input parameters and the inline 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) } } )