find-item
Locate a specific item in your Minecraft bot's inventory by name or type to manage resources and plan actions effectively.
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/bot.ts:287-309 (registration)Registration of the 'find-item' MCP tool including schema and handler in the registerInventoryTools function.server.tool( "find-item", "Find a specific item in the bot's inventory", { nameOrType: z.string().describe("Name or type of item to find") }, async ({ nameOrType }): Promise<McpResponse> => { try { const items = bot.inventory.items(); const item = items.find((item: any) => item.name.includes(nameOrType.toLowerCase()) ); if (item) { return createResponse(`Found ${item.count} ${item.name} in inventory (slot ${item.slot})`); } else { return createResponse(`Couldn't find any item matching '${nameOrType}' in inventory`); } } catch (error) { return createErrorResponse(error as Error); } } );
- src/bot.ts:293-308 (handler)Handler function that searches the bot's inventory for an item matching the given nameOrType (case-insensitive), returns count, name, and slot if found, or a not-found message.async ({ nameOrType }): Promise<McpResponse> => { try { const items = bot.inventory.items(); const item = items.find((item: any) => item.name.includes(nameOrType.toLowerCase()) ); if (item) { return createResponse(`Found ${item.count} ${item.name} in inventory (slot ${item.slot})`); } else { return createResponse(`Couldn't find any item matching '${nameOrType}' in inventory`); } } catch (error) { return createErrorResponse(error as Error); } }
- src/bot.ts:290-292 (schema)Input schema defining the required 'nameOrType' parameter as a string for the item to search for.{ nameOrType: z.string().describe("Name or type of item to find") },