get-block-info
Retrieve detailed information about blocks at specific coordinates in Minecraft, enabling players to identify materials and properties for building or exploration.
Instructions
Get information about a block at the specified position
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | X coordinate | |
| y | Yes | Y coordinate | |
| z | Yes | Z coordinate |
Implementation Reference
- src/bot.ts:446-459 (handler)The asynchronous handler function that executes the 'get-block-info' tool. It retrieves the block at the given (x,y,z) coordinates using bot.blockAt and returns information about the block including its name, type, and position.async ({ x, y, z }): Promise<McpResponse> => { try { const blockPos = new Vec3(x, y, z); const block = bot.blockAt(blockPos); if (!block) { return createResponse(`No block information found at position (${x}, ${y}, ${z})`); } return createResponse(`Found ${block.name} (type: ${block.type}) at position (${block.position.x}, ${block.position.y}, ${block.position.z})`); } catch (error) { return createErrorResponse(error as Error); } }
- src/bot.ts:441-445 (schema)The input schema using Zod for validating the parameters x, y, z coordinates required by the 'get-block-info' tool.{ x: z.number().describe("X coordinate"), y: z.number().describe("Y coordinate"), z: z.number().describe("Z coordinate"), },
- src/bot.ts:438-460 (registration)The registration of the 'get-block-info' tool on the MCP server, including name, description, input schema, and inline handler function.server.tool( "get-block-info", "Get information about a block at the specified position", { x: z.number().describe("X coordinate"), y: z.number().describe("Y coordinate"), z: z.number().describe("Z coordinate"), }, async ({ x, y, z }): Promise<McpResponse> => { try { const blockPos = new Vec3(x, y, z); const block = bot.blockAt(blockPos); if (!block) { return createResponse(`No block information found at position (${x}, ${y}, ${z})`); } return createResponse(`Found ${block.name} (type: ${block.type}) at position (${block.position.x}, ${block.position.y}, ${block.position.z})`); } catch (error) { return createErrorResponse(error as Error); } } );