equip-item
Equip an item to a specified slot in Minecraft, enabling character customization and gameplay adjustments through item management.
Instructions
Equip a specific item
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| itemName | Yes | Name of the item to equip | |
| destination | No | Where to equip the item (default: 'hand') |
Implementation Reference
- src/tools/inventory-tools.ts:66-79 (handler)Handler function that locates an item in the bot's inventory by name and equips it to the specified destination (default 'hand') using mineflayer's bot.equip method.async ({ itemName, destination = 'hand' }) => { const bot = getBot(); const items = bot.inventory.items(); const item = items.find((item) => item.name.includes(itemName.toLowerCase()) ); if (!item) { return factory.createResponse(`Couldn't find any item matching '${itemName}' in inventory`); } await bot.equip(item, destination as mineflayer.EquipmentDestination); return factory.createResponse(`Equipped ${item.name} to ${destination}`); }
- src/tools/inventory-tools.ts:62-65 (schema)Zod schema defining the input parameters for the equip-item tool: itemName (required string) and optional destination (string, defaults to 'hand').{ itemName: z.string().describe("Name of the item to equip"), destination: z.string().optional().describe("Where to equip the item (default: 'hand')") },
- src/tools/inventory-tools.ts:59-80 (registration)Registration of the 'equip-item' tool using factory.registerTool, including name, description, input schema, and inline handler function.factory.registerTool( "equip-item", "Equip a specific item", { itemName: z.string().describe("Name of the item to equip"), destination: z.string().optional().describe("Where to equip the item (default: 'hand')") }, async ({ itemName, destination = 'hand' }) => { const bot = getBot(); const items = bot.inventory.items(); const item = items.find((item) => item.name.includes(itemName.toLowerCase()) ); if (!item) { return factory.createResponse(`Couldn't find any item matching '${itemName}' in inventory`); } await bot.equip(item, destination as mineflayer.EquipmentDestination); return factory.createResponse(`Equipped ${item.name} to ${destination}`); } );