Skip to main content
Glama

list-inventory

Retrieve a detailed list of all items in the bot's inventory for real-time management and organization within Minecraft using the MCP server.

Instructions

List all items in the bot's inventory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler logic for the list-inventory tool. It fetches inventory items from the Mineflayer bot, maps to InventoryItem structs, formats a text list or empty message, and returns via factory.createResponse.
    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); }
  • Direct registration of the list-inventory tool using ToolFactory.registerTool, with name, description, empty 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); } );
  • TypeScript interface defining structure of inventory items, used in the list-inventory handler for mapping bot items.
    interface InventoryItem { name: string; count: number; slot: number; }
  • src/main.ts:52-52 (registration)
    Top-level invocation of registerInventoryTools function, which performs the registration of list-inventory and other inventory tools.
    registerInventoryTools(factory, getBot);

Other Tools

Related Tools

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/yuniko-software/minecraft-mcp-server'

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