Skip to main content
Glama

equip-item

Equip a specific item in Minecraft by specifying its name and destination (e.g., hand) using MCP-minecraft server, enabling real-time character control through the Mineflayer API.

Instructions

Equip a specific item

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destinationNoWhere to equip the item (default: 'hand')
itemNameYesName of the item to equip

Implementation Reference

  • Handler function that finds the item in the bot's inventory by name and equips it to the specified destination (default 'hand') using bot.equip(). Returns success or not found message.
    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}`); }
  • Input schema defining 'itemName' as required string and optional 'destination' string using Zod.
    { itemName: z.string().describe("Name of the item to equip"), destination: z.string().optional().describe("Where to equip the item (default: 'hand')") },
  • Registers the 'equip-item' tool with ToolFactory, including name, description, input schema, and 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}`); } );

Other Tools

Related Tools

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/yuniko-software/minecraft-mcp-server'

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