equipItem
Equip items from inventory to hand or armor slots in Minecraft. Specify item name and destination slot to manage player equipment.
Instructions
Equip an item from inventory to hand or armor slot
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| itemName | Yes | Name of the item to equip | |
| destination | No | Slot to equip the item to | hand |
Implementation Reference
- src/tools/inventoryManagement.ts:22-47 (handler)Handler for the equipItem tool. Checks if bot is connected, finds the item in inventory by case-insensitive name match, equips it to the specified slot (hand, head, torso, legs, feet) using bot.equip(), returns success or error response.async ({ itemName, destination }) => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { // Find the item in inventory const item = botState.bot.inventory .items() .find((item) => item.name.toLowerCase() === itemName.toLowerCase()) if (!item) { return createSuccessResponse( `Item "${itemName}" not found in inventory.` ) } // Equip the item to the specified destination await botState.bot.equip(item, destination) return createSuccessResponse( `Successfully equipped ${itemName} to ${destination}` ) } catch (error) { return createErrorResponse(error) } }
- Input schema for equipItem tool using Zod: itemName (required string), destination (optional enum with default 'hand').{ itemName: z.string().describe('Name of the item to equip'), destination: z .enum(['hand', 'head', 'torso', 'legs', 'feet']) .default('hand') .describe('Slot to equip the item to'), },
- src/tools/inventoryManagement.ts:12-48 (registration)Direct registration of the equipItem tool using server.tool(), including name, description, schema, and inline handler.server.tool( 'equipItem', 'Equip an item from inventory to hand or armor slot', { itemName: z.string().describe('Name of the item to equip'), destination: z .enum(['hand', 'head', 'torso', 'legs', 'feet']) .default('hand') .describe('Slot to equip the item to'), }, async ({ itemName, destination }) => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { // Find the item in inventory const item = botState.bot.inventory .items() .find((item) => item.name.toLowerCase() === itemName.toLowerCase()) if (!item) { return createSuccessResponse( `Item "${itemName}" not found in inventory.` ) } // Equip the item to the specified destination await botState.bot.equip(item, destination) return createSuccessResponse( `Successfully equipped ${itemName} to ${destination}` ) } catch (error) { return createErrorResponse(error) } } )
- src/tools/index.ts:32-32 (registration)Invocation of registerInventoryManagementTools() within registerAllTools(), which performs the equipItem registration.registerInventoryManagementTools()
- src/index.ts:7-7 (registration)Top-level call to registerAllTools() in main index, which chains to equipItem registration.registerAllTools()