Skip to main content
Glama
zeeweebee

Minecraft MCP Server

by zeeweebee

find-item

Locate a specific item in the bot's Minecraft inventory by specifying its name or type using the MCP server's inventory search tool.

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 for the 'find-item' tool. It retrieves all inventory items, finds the first one whose name includes the provided nameOrType (case-insensitive), and returns details including count and slot, or a not-found message.
    async ({ nameOrType }): Promise<McpResponse> => { try { const items = bot.inventory.items(); const item = items.find((item: any) => item.name.includes(nameOrType.toLowerCase()) ); if (item) { return createResponse(`Found ${item.count} ${item.name} in inventory (slot ${item.slot})`); } else { return createResponse(`Couldn't find any item matching '${nameOrType}' in inventory`); } } catch (error) { return createErrorResponse(error as Error); } }
  • Zod input schema for the 'find-item' tool, defining the required 'nameOrType' string parameter.
    { nameOrType: z.string().describe("Name or type of item to find") },
  • src/bot.ts:287-309 (registration)
    The server.tool call that registers the 'find-item' tool on the MCP server, including its name, description, input schema, and handler function.
    server.tool( "find-item", "Find a specific item in the bot's inventory", { nameOrType: z.string().describe("Name or type of item to find") }, async ({ nameOrType }): Promise<McpResponse> => { try { const items = bot.inventory.items(); const item = items.find((item: any) => item.name.includes(nameOrType.toLowerCase()) ); if (item) { return createResponse(`Found ${item.count} ${item.name} in inventory (slot ${item.slot})`); } else { return createResponse(`Couldn't find any item matching '${nameOrType}' in inventory`); } } 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