Skip to main content
Glama

checkInventory

Retrieve and view the items in a player's inventory directly within Minecraft. Simplify inventory management by accessing item details through remote server commands.

Instructions

Check the items in the player inventory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function that implements the core logic of the 'checkInventory' tool. It verifies bot connection, fetches inventory items, formats the item list (name x count), and returns a formatted success response or handles errors appropriately.
    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 registration of the 'checkInventory' tool via server.tool(), including the tool name, description, empty input 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