find-item
Locate a specific item in your Minecraft bot's inventory by name or type to manage resources and plan actions effectively.
Instructions
Find a specific item in the bot's inventory
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"nameOrType": "<nameOrType>"
},
"name": "find-item"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nameOrType | Yes | Name or type of item to find |
Implementation Reference
- src/bot.ts:287-309 (registration)Registration of the 'find-item' MCP tool including schema and handler in the registerInventoryTools 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); } } ); - src/bot.ts:293-308 (handler)Handler function that searches the bot's inventory for an item matching the given nameOrType (case-insensitive), returns count, name, and slot if found, 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); } } - src/bot.ts:290-292 (schema)Input schema defining the required 'nameOrType' parameter as a string for the item to search for.
{ nameOrType: z.string().describe("Name or type of item to find") },