openInventory
Access and manage the bot's inventory on Minecraft MCP Server, enabling precise control over items for crafting, building, and other in-game tasks.
Instructions
Open the bot's inventory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function that implements the 'openInventory' tool logic. It checks for required parameters (none), lists all items in the bot's inventory, formats a descriptive string, logs it, emits an end observation event, and returns success.export const openInventory = async ( bot: Bot, params: ISkillParams, serviceParams: ISkillServiceParams, ): Promise<boolean> => { const skillName = 'openInventory'; 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 inventory = bot.inventory.items(); let inventoryStr = inventory .map((item) => `${item.count} ${item.displayName.toLowerCase()}`) .join(', '); if (inventoryStr.length === 0) inventoryStr = 'nothing.'; const logMessage = `You just finished examining your inventory and it contains: ${inventoryStr}.`; console.log(logMessage); bot.emit('alteraBotEndObservation', logMessage); return true; };
- Schema definition for the 'openInventory' tool, specifying no input parameters are required.openInventory: { description: "Open the bot's inventory", params: {}, required: [] },
- mcp-server/src/skillRegistry.ts:350-367 (registration)The loadSkills function iterates over SKILL_METADATA (which includes 'openInventory') to register all skills by creating SkillDefinition objects with name, description, inputSchema, and a dynamic executor that loads the implementation from the skills/verified directory.export async function loadSkills(): Promise<SkillDefinition[]> { const skills: SkillDefinition[] = []; for (const [skillName, metadata] of Object.entries(SKILL_METADATA)) { skills.push({ name: skillName, description: metadata.description, inputSchema: { type: "object", properties: metadata.params, required: metadata.required }, execute: createSkillExecutor(skillName) }); } return skills; }