Skip to main content
Glama

getRecipes

Retrieve Minecraft crafting recipes from a remote server to find item recipes and crafting instructions for in-game use.

Instructions

Get a list of available crafting recipes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNoFilter recipes by item name

Implementation Reference

  • Handler function that fetches crafting recipes using the mineflayer bot's recipesFor method, groups them by output item, formats a detailed response, and handles errors or no-connection states.
    async ({ filter }) => {
      if (!botState.isConnected || !botState.bot) {
        return createNotConnectedResponse()
      }
    
      try {
        // In mineflayer API, first parameter should be itemType (number), not filter string
        // Using a regex match or 0 as a wildcard for all items
        const itemType = filter ? 0 : 0 // 0 is used as a wildcard
        const recipes = botState.bot.recipesFor(itemType, null, null, null)
    
        if (recipes.length === 0) {
          return createSuccessResponse(
            filter
              ? `No recipes found for "${filter}".`
              : 'No recipes available.'
          )
        }
    
        // Group recipes by output item
        type RecipeGroups = Record<string, Array<any>>
        const groupedRecipes: RecipeGroups = {}
        recipes.forEach((recipe) => {
          const outputName =
            recipe.result &&
            typeof recipe.result === 'object' &&
            'name' in recipe.result
              ? recipe.result.name
              : 'Unknown'
    
          // Use type assertion to help TypeScript understand the key is valid
          const key = outputName as string
          if (!groupedRecipes[key]) {
            groupedRecipes[key] = []
          }
          groupedRecipes[key].push(recipe)
        })
    
        // Format the response
        let response = filter
          ? `Available recipes for "${filter}":\n\n`
          : `Available recipes (${recipes.length}):\n\n`
    
        for (const [output, recipes] of Object.entries(groupedRecipes)) {
          response += `${output} (${recipes.length} recipe${
            recipes.length > 1 ? 's' : ''
          }):\n`
    
          recipes.forEach((recipe, index) => {
            response += `  Recipe ${index + 1}:\n`
    
            // Add ingredients
            if (
              recipe.ingredients &&
              Array.isArray(recipe.ingredients) &&
              recipe.ingredients.length > 0
            ) {
              response += '    Ingredients:\n'
              recipe.ingredients.forEach((item: any) => {
                const count = item.count || 1
                response += `      - ${item.name} x${count}\n`
              })
            }
    
            response += '\n'
          })
        }
    
        return createSuccessResponse(response)
      } catch (error) {
        return createErrorResponse(error)
      }
    }
  • Input schema for the getRecipes tool using Zod, defining an optional 'filter' string parameter.
    {
      filter: z.string().optional().describe('Filter recipes by item name'),
    },
  • Direct registration of the 'getRecipes' tool on the server using server.tool, specifying name, description, input schema, and inline handler.
      'getRecipes',
      'Get a list of available crafting recipes',
      {
        filter: z.string().optional().describe('Filter recipes by item name'),
      },
      async ({ filter }) => {
        if (!botState.isConnected || !botState.bot) {
          return createNotConnectedResponse()
        }
    
        try {
          // In mineflayer API, first parameter should be itemType (number), not filter string
          // Using a regex match or 0 as a wildcard for all items
          const itemType = filter ? 0 : 0 // 0 is used as a wildcard
          const recipes = botState.bot.recipesFor(itemType, null, null, null)
    
          if (recipes.length === 0) {
            return createSuccessResponse(
              filter
                ? `No recipes found for "${filter}".`
                : 'No recipes available.'
            )
          }
    
          // Group recipes by output item
          type RecipeGroups = Record<string, Array<any>>
          const groupedRecipes: RecipeGroups = {}
          recipes.forEach((recipe) => {
            const outputName =
              recipe.result &&
              typeof recipe.result === 'object' &&
              'name' in recipe.result
                ? recipe.result.name
                : 'Unknown'
    
            // Use type assertion to help TypeScript understand the key is valid
            const key = outputName as string
            if (!groupedRecipes[key]) {
              groupedRecipes[key] = []
            }
            groupedRecipes[key].push(recipe)
          })
    
          // Format the response
          let response = filter
            ? `Available recipes for "${filter}":\n\n`
            : `Available recipes (${recipes.length}):\n\n`
    
          for (const [output, recipes] of Object.entries(groupedRecipes)) {
            response += `${output} (${recipes.length} recipe${
              recipes.length > 1 ? 's' : ''
            }):\n`
    
            recipes.forEach((recipe, index) => {
              response += `  Recipe ${index + 1}:\n`
    
              // Add ingredients
              if (
                recipe.ingredients &&
                Array.isArray(recipe.ingredients) &&
                recipe.ingredients.length > 0
              ) {
                response += '    Ingredients:\n'
                recipe.ingredients.forEach((item: any) => {
                  const count = item.count || 1
                  response += `      - ${item.name} x${count}\n`
                })
              }
    
              response += '\n'
            })
          }
    
          return createSuccessResponse(response)
        } catch (error) {
          return createErrorResponse(error)
        }
      }
    )
  • Invocation of registerCraftingTools() within registerAllTools(), which registers the getRecipes tool among others.
    registerCraftingTools()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it 'gets a list' but doesn't describe what the list contains, how it's formatted, whether it's paginated, or any constraints like rate limits or authentication needs. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that states the tool's purpose without any unnecessary words. It's appropriately sized and front-loaded with the essential information, making it highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the returned list looks like, what information it contains, or any behavioral aspects. For a tool that presumably returns structured data about recipes, this leaves too much unspecified for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the single parameter 'filter' fully documented in the schema as 'Filter recipes by item name'. The description adds no additional parameter information beyond what the schema provides, so it meets the baseline score when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and resource 'list of available crafting recipes', making the purpose immediately understandable. However, it doesn't differentiate this tool from potential sibling tools like 'craftItem' or 'listTrades', which might also involve recipes, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'craftItem', 'listTrades', and 'inventoryDetails' that might relate to recipes, there's no indication of when this specific listing tool is appropriate versus those other options.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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