list-inventory
View all items in the bot's inventory to manage resources and plan actions in Minecraft.
Instructions
List all items in the bot's inventory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/inventory-tools.ts:16-35 (handler)Handler function that lists all items in the bot's inventory by fetching from bot.inventory.items(), mapping to a list, and formatting as text response.async () => { const bot = getBot(); const items = bot.inventory.items(); const itemList: InventoryItem[] = items.map((item) => ({ name: item.name, count: item.count, slot: item.slot })); if (items.length === 0) { return factory.createResponse("Inventory is empty"); } let inventoryText = `Found ${items.length} items in inventory:\n\n`; itemList.forEach(item => { inventoryText += `- ${item.name} (x${item.count}) in slot ${item.slot}\n`; }); return factory.createResponse(inventoryText); }
- src/tools/inventory-tools.ts:12-36 (registration)Registers the list-inventory tool with ToolFactory, including description, empty input schema {}, and inline handler.factory.registerTool( "list-inventory", "List all items in the bot's inventory", {}, async () => { const bot = getBot(); const items = bot.inventory.items(); const itemList: InventoryItem[] = items.map((item) => ({ name: item.name, count: item.count, slot: item.slot })); if (items.length === 0) { return factory.createResponse("Inventory is empty"); } let inventoryText = `Found ${items.length} items in inventory:\n\n`; itemList.forEach(item => { inventoryText += `- ${item.name} (x${item.count}) in slot ${item.slot}\n`; }); return factory.createResponse(inventoryText); } );
- src/main.ts:52-52 (registration)Top-level call to registerInventoryTools function, which registers the list-inventory tool among others.registerInventoryTools(factory, getBot);