Skip to main content
Glama
zeeweebee

Minecraft MCP Server

by zeeweebee

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
NameRequiredDescriptionDefault
xYesX coordinate
yYesY coordinate
zYesZ coordinate

Implementation Reference

  • 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);
      }
    }
  • 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);
        }
      }
    );

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