Skip to main content
Glama
zeeweebee

Minecraft MCP Server

by zeeweebee

dig-block

Remove a Minecraft block by specifying its X, Y, and Z coordinates using this tool on the MCP Server, enabling precise in-game actions for AI-controlled characters.

Instructions

Dig a block at the specified position

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX coordinate
yYesY coordinate
zYesZ coordinate

Implementation Reference

  • The handler function for the 'dig-block' tool. It checks for a block at the position, moves closer if unable to dig/see it, and digs the block using bot.dig().
    async ({ x, y, z }): Promise<McpResponse> => { try { const blockPos = new Vec3(x, y, z); const block = bot.blockAt(blockPos); if (!block || block.name === 'air') { return createResponse(`No block found at position (${x}, ${y}, ${z})`); } if (!bot.canDigBlock(block) || !bot.canSeeBlock(block)) { // Try to move closer to dig the block const goal = new goals.GoalNear(x, y, z, 2); await bot.pathfinder.goto(goal); } await bot.dig(block); return createResponse(`Dug ${block.name} at (${x}, ${y}, ${z})`); } catch (error) { return createErrorResponse(error as Error); } }
  • Zod schema defining the input parameters for the dig-block tool: x, y, z coordinates.
    { x: z.number().describe("X coordinate"), y: z.number().describe("Y coordinate"), z: z.number().describe("Z coordinate"), },
  • src/bot.ts:406-436 (registration)
    The MCP server.tool() call that registers the 'dig-block' tool, including name, description, schema, and handler.
    server.tool( "dig-block", "Dig 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 || block.name === 'air') { return createResponse(`No block found at position (${x}, ${y}, ${z})`); } if (!bot.canDigBlock(block) || !bot.canSeeBlock(block)) { // Try to move closer to dig the block const goal = new goals.GoalNear(x, y, z, 2); await bot.pathfinder.goto(goal); } await bot.dig(block); return createResponse(`Dug ${block.name} at (${x}, ${y}, ${z})`); } 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