Skip to main content
Glama

checkInventory

View player inventory contents in Minecraft to track items, manage resources, and plan actions during gameplay.

Instructions

Check the items in the player inventory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function that executes the checkInventory tool logic: checks if bot is connected, retrieves inventory items, formats them into a string, and returns a success response or appropriate error.
    async () => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { const items = botState.bot.inventory.items() if (items.length === 0) { return createSuccessResponse('Inventory is empty.') } const itemList = items .map((item) => `${item.name} x${item.count}`) .join(', ') return createSuccessResponse(`Inventory contains: ${itemList}`) } catch (error) { return createErrorResponse(error) } }
  • The server.tool call that registers the 'checkInventory' tool with its description, empty schema ({}), and inline handler function.
    server.tool( 'checkInventory', 'Check the items in the player inventory', {}, async () => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { const items = botState.bot.inventory.items() if (items.length === 0) { return createSuccessResponse('Inventory is empty.') } const itemList = items .map((item) => `${item.name} x${item.count}`) .join(', ') return createSuccessResponse(`Inventory contains: ${itemList}`) } catch (error) { return createErrorResponse(error) } } )

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/nacal/mcp-minecraft-remote'

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