Skip to main content
Glama

openNearbyChest

Locate and open the nearest chest in Minecraft using this MCP Server tool. Simplify inventory management and item collection during gameplay.

Instructions

Open a nearby chest

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function implementing the openNearbyChest tool logic. It validates parameters, finds nearby chests using helper functions, navigates to the closest chest, opens it by looking at it and updating the chest interface, and emits observations.
    export const openNearbyChest = async ( bot: Bot, params: ISkillParams, serviceParams: ISkillServiceParams, ): Promise<boolean> => { const skillName = 'openNearbyChest'; const requiredParams: string[] = []; const isParamsValid = validateSkillParams( params, requiredParams, skillName, ); if (!isParamsValid) { serviceParams.cancelExecution?.(); bot.emit( 'alteraBotEndObservation', `Mistake: You didn't provide all of the required parameters ${requiredParams.join(', ')} for the ${skillName} skill.`, ); return false; } const unpackedParams = { setStatsData: serviceParams.setStatsData, getStatsData: serviceParams.getStatsData, signal: serviceParams.signal, }; const {setStatsData, getStatsData, signal} = unpackedParams; const NEARBY_DISTANCE = bot.nearbyBlockXZRange; const chestPositions = findNearbyChests(bot, { searchRadius: NEARBY_DISTANCE, maxChests: 3, }); if (chestPositions.length === 0) { return bot.emit( 'alteraBotEndObservation', 'You tried to open a nearby chest but no chests found nearby. If you were taking out items, no items were taken out.', ); } const chestPosition = await findAChest(bot, {posToAvoid: null}); if (chestPosition) { const navigateToLocationFunc = async function () { return navigateToLocation(bot, { x: chestPosition.x, y: chestPosition.y, z: chestPosition.z, range: 2, }); }; await asyncwrap({func: navigateToLocationFunc, setStatsData, getStatsData}); // check for cancelation signal if (isSignalAborted(signal)) { return bot.emit( 'alteraBotEndObservation', `You decided to do something else and stopped opening the chest.`, ); } const chestBlock = bot.blockAt(chestPosition); bot.lookAt(chestPosition.offset(0.5, 0.5, 0.5)); if (!chestBlock) return bot.emit( 'alteraBotEndObservation', 'The chest you were trying to open no longer exists!', ); await updateChestInterface(bot, { chestPosition, getStatsData, setStatsData, }); return bot.emit( 'alteraBotEndObservation', `You have opened a chest at ${chestPosition}.`, ); } else { return bot.emit( 'alteraBotEndObservation', 'You tried to open a nearby chest but there are no chests nearby. If you were taking out items, no items were taken out.', ); } };
  • Registration metadata for the openNearbyChest tool in SKILL_METADATA, defining its description and empty input schema. This is used by loadSkills() to register the tool dynamically by importing and executing the handler from the corresponding skill file.
    openNearbyChest: { description: "Open a nearby chest", params: {}, required: [] },
  • Input schema definition for openNearbyChest: no required parameters, empty params object.
    openNearbyChest: { description: "Open a nearby chest", params: {}, required: [] },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/leo4life2/minecraft-mcp-http'

If you have feedback or need assistance with the MCP directory API, please join our Discord server