Skip to main content
Glama

find-item

Locate a specific item in the bot's inventory by providing its name or type, facilitating quick inventory management in Minecraft through the mcp-minecraft server.

Instructions

Find a specific item in the bot's inventory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameOrTypeYesName or type of item to find

Implementation Reference

  • Handler function that finds an item in the bot's inventory by name or type, using mineflayer bot.inventory.items() and returns details or not found message.
    async ({ nameOrType }) => { const bot = getBot(); const items = bot.inventory.items(); const item = items.find((item) => item.name.includes(nameOrType.toLowerCase()) ); if (item) { return factory.createResponse(`Found ${item.count} ${item.name} in inventory (slot ${item.slot})`); } else { return factory.createResponse(`Couldn't find any item matching '${nameOrType}' in inventory`); } }
  • Zod schema defining the input parameter 'nameOrType' for the find-item tool.
    { nameOrType: z.string().describe("Name or type of item to find") },
  • Registers the 'find-item' tool using ToolFactory.registerTool, including name, description, schema, and handler.
    factory.registerTool( "find-item", "Find a specific item in the bot's inventory", { nameOrType: z.string().describe("Name or type of item to find") }, async ({ nameOrType }) => { const bot = getBot(); const items = bot.inventory.items(); const item = items.find((item) => item.name.includes(nameOrType.toLowerCase()) ); if (item) { return factory.createResponse(`Found ${item.count} ${item.name} in inventory (slot ${item.slot})`); } else { return factory.createResponse(`Couldn't find any item matching '${nameOrType}' in inventory`); } } );
  • src/main.ts:52-52 (registration)
    Calls registerInventoryTools which includes registration of the 'find-item' tool.
    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