Skip to main content
Glama
zeeweebee

Minecraft MCP Server

by zeeweebee

dig-block

Remove blocks at specified coordinates in Minecraft to clear terrain, create pathways, or gather resources through precise positional control.

Instructions

Dig a block at the specified position

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX coordinate
yYesY coordinate
zYesZ coordinate

Implementation Reference

  • The main handler function for the 'dig-block' tool. It resolves the block position, checks if diggable, moves if necessary, and calls bot.dig(block) to dig it.
    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: x, y, z coordinates as numbers.
    { 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 server.tool() call that registers the 'dig-block' tool with its name, description, schema, and handler function.
    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); } } );

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