Skip to main content
Glama

craftItem

Craft items in Minecraft using available materials. Specify the item name and quantity to create items through the MCP Minecraft Remote server.

Instructions

Craft an item using available materials

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemNameYesName of the item to craft
countNoNumber of items to craft

Implementation Reference

  • Executes the craftItem tool: finds recipes using wildcard itemType=0, selects first recipe, crafts using bot.craft if possible, handles errors.
    if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { // For crafting, we need to get the itemType from a name lookup or approximate it // This is a simple workaround - ideally, we'd have a proper mapping of names to IDs const itemType = 0 // Using 0 as a wildcard to get all recipes const recipes = botState.bot.recipesFor(itemType, null, count, null) if (recipes.length === 0) { return createSuccessResponse( `No recipes found for "${itemName}" or insufficient materials.` ) } // Choose the first available recipe const recipe = recipes[0] // Craft the item await botState.bot.craft(recipe, count) return createSuccessResponse( `Successfully crafted ${count} x ${itemName}` ) } catch (error) { return createErrorResponse(error) } } )
  • Input schema using Zod for craftItem tool parameters.
    itemName: z.string().describe('Name of the item to craft'), count: z .number() .optional() .default(1) .describe('Number of items to craft'), }, async ({ itemName, count }) => {
  • Direct registration of the craftItem tool using server.tool including schema and handler.
    'craftItem', 'Craft an item using available materials', { itemName: z.string().describe('Name of the item to craft'), count: z .number() .optional() .default(1) .describe('Number of items to craft'), }, async ({ itemName, count }) => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { // For crafting, we need to get the itemType from a name lookup or approximate it // This is a simple workaround - ideally, we'd have a proper mapping of names to IDs const itemType = 0 // Using 0 as a wildcard to get all recipes const recipes = botState.bot.recipesFor(itemType, null, count, null) if (recipes.length === 0) { return createSuccessResponse( `No recipes found for "${itemName}" or insufficient materials.` ) } // Choose the first available recipe const recipe = recipes[0] // Craft the item await botState.bot.craft(recipe, count) return createSuccessResponse( `Successfully crafted ${count} x ${itemName}` ) } catch (error) { return createErrorResponse(error) } } )
  • Higher-level registration call to registerCraftingTools() which registers craftItem among other crafting tools.
    registerCraftingTools()

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