Skip to main content
Glama

find-item

Locate specific items in a Minecraft bot's inventory by name or type to manage resources and equipment during gameplay.

Instructions

Find a specific item in the bot's inventory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameOrTypeYesName or type of item to find

Implementation Reference

  • The handler function that finds and reports an item in the bot's inventory matching the given nameOrType.
    async ({ nameOrType }) => {
      const bot = getBot();
      const items = bot.inventory.items();
      const item = items.find((item) =>
        item.name.includes(nameOrType.toLowerCase())
      );
    
      if (item) {
        return factory.createResponse(`Found ${item.count} ${item.name} in inventory (slot ${item.slot})`);
      } else {
        return factory.createResponse(`Couldn't find any item matching '${nameOrType}' in inventory`);
      }
    }
  • Input schema using Zod for the 'nameOrType' parameter.
    {
      nameOrType: z.string().describe("Name or type of item to find")
    },
  • Registers the "find-item" tool with the ToolFactory, including name, description, input schema, and handler function.
    factory.registerTool(
      "find-item",
      "Find a specific item in the bot's inventory",
      {
        nameOrType: z.string().describe("Name or type of item to find")
      },
      async ({ nameOrType }) => {
        const bot = getBot();
        const items = bot.inventory.items();
        const item = items.find((item) =>
          item.name.includes(nameOrType.toLowerCase())
        );
    
        if (item) {
          return factory.createResponse(`Found ${item.count} ${item.name} in inventory (slot ${item.slot})`);
        } else {
          return factory.createResponse(`Couldn't find any item matching '${nameOrType}' in inventory`);
        }
      }
    );
  • src/main.ts:52-52 (registration)
    Top-level registration call for the inventory tools module, which includes the "find-item" tool.
    registerInventoryTools(factory, getBot);

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