Skip to main content
Glama

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
NameRequiredDescriptionDefault
itemNameYesName of the item to equip
destinationNoSlot to equip the item tohand

Implementation Reference

  • 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'), },
  • 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) } } )
  • 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()

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/nacal/mcp-minecraft-remote'

If you have feedback or need assistance with the MCP directory API, please join our Discord server