find-item
Locate specific items in a Minecraft bot's inventory by name or type to manage resources and equipment during gameplay.
Instructions
Find a specific item in the bot's inventory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nameOrType | Yes | Name or type of item to find |
Implementation Reference
- src/tools/inventory-tools.ts:44-56 (handler)The handler function that finds and reports an item in the bot's inventory matching the given nameOrType.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/tools/inventory-tools.ts:41-43 (schema)Input schema using Zod for the 'nameOrType' parameter.{ nameOrType: z.string().describe("Name or type of item to find") },
- src/tools/inventory-tools.ts:38-57 (registration)Registers the "find-item" tool with the ToolFactory, including name, description, input schema, and handler function.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)Top-level registration call for the inventory tools module, which includes the "find-item" tool.registerInventoryTools(factory, getBot);