Skip to main content
Glama
zeeweebee

Minecraft MCP Server

by zeeweebee

list-inventory

Display all items in the Minecraft bot's inventory to manage resources, track items, and optimize in-game actions efficiently.

Instructions

List all items in the bot's inventory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'list-inventory' tool. It fetches all items from the bot's inventory using bot.inventory.items(), maps them to a structured format, and returns a formatted text list or 'Inventory is empty' if none.
    async (): Promise<McpResponse> => { try { const items = bot.inventory.items(); const itemList: InventoryItem[] = items.map((item: any) => ({ name: item.name, count: item.count, slot: item.slot })); if (items.length === 0) { return 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 createResponse(inventoryText); } catch (error) { return createErrorResponse(error as Error); } }
  • src/bot.ts:258-285 (registration)
    Registration of the 'list-inventory' tool via server.tool() within the registerInventoryTools function, including empty input schema and inline handler.
    server.tool( "list-inventory", "List all items in the bot's inventory", {}, async (): Promise<McpResponse> => { try { const items = bot.inventory.items(); const itemList: InventoryItem[] = items.map((item: any) => ({ name: item.name, count: item.count, slot: item.slot })); if (items.length === 0) { return 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 createResponse(inventoryText); } catch (error) { return createErrorResponse(error as Error); } } );
  • Type interface used in the list-inventory handler to structure inventory item data.
    interface InventoryItem { name: string; count: number; slot: number; }

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/zeeweebee/mcp-server'

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