Skip to main content
Glama
zeeweebee

Minecraft MCP Server

by zeeweebee

equip-item

Equip a specific item in Minecraft by specifying its name and destination, enabling precise control of in-game actions through the MCP server for AI-driven gameplay.

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

  • The handler function that implements the core logic of the 'equip-item' tool. It searches the bot's inventory for an item matching the provided name (case-insensitive partial match), equips it to the specified destination slot (defaults to 'hand'), and handles errors appropriately.
    async ({ itemName, destination = 'hand' }): Promise<McpResponse> => { try { const items = bot.inventory.items(); const item = items.find((item: any) => item.name.includes(itemName.toLowerCase()) ); if (!item) { return createResponse(`Couldn't find any item matching '${itemName}' in inventory`); } await bot.equip(item, destination as mineflayer.EquipmentDestination); return createResponse(`Equipped ${item.name} to ${destination}`); } catch (error) { return createErrorResponse(error as Error); } }
  • Zod schema defining the input parameters for the 'equip-item' tool: itemName (required string) and destination (optional string). Note: startLine adjusted to the schema object for precision.
    itemName: z.string().describe("Name of the item to equip"), destination: z.string().optional().describe("Where to equip the item (default: 'hand')") },
  • src/bot.ts:311-335 (registration)
    The registration of the 'equip-item' tool via server.tool(), including name, description, input schema, and handler function. Located within the registerInventoryTools function.
    server.tool( "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' }): Promise<McpResponse> => { try { const items = bot.inventory.items(); const item = items.find((item: any) => item.name.includes(itemName.toLowerCase()) ); if (!item) { return createResponse(`Couldn't find any item matching '${itemName}' in inventory`); } await bot.equip(item, destination as mineflayer.EquipmentDestination); return createResponse(`Equipped ${item.name} to ${destination}`); } catch (error) { return createErrorResponse(error as Error); } } );

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/zeeweebee/mcp-server'

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