Skip to main content
Glama

dig-block

Remove a Minecraft block at specified coordinates (x, y, z) using the MCP server, enabling real-time game interaction and structure modification.

Instructions

Dig a block at the specified position

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX coordinate
yYesY coordinate
zYesZ coordinate

Implementation Reference

  • The handler function executes the digging logic: checks for block at position, navigates if needed using pathfinder, then calls bot.dig(block).
    async ({ x, y, z }) => { const bot = getBot(); const blockPos = new Vec3(x, y, z); const block = bot.blockAt(blockPos); if (!block || block.name === 'air') { return factory.createResponse(`No block found at position (${x}, ${y}, ${z})`); } if (!bot.canDigBlock(block) || !bot.canSeeBlock(block)) { const goal = new goals.GoalNear(x, y, z, 2); await bot.pathfinder.goto(goal); } await bot.dig(block); return factory.createResponse(`Dug ${block.name} at (${x}, ${y}, ${z})`); }
  • Zod schema defining required numeric inputs for x, y, z coordinates.
    { x: z.number().describe("X coordinate"), y: z.number().describe("Y coordinate"), z: z.number().describe("Z coordinate"), },
  • The factory.registerTool call registers the "dig-block" tool with its schema and handler within the registerBlockTools function.
    factory.registerTool( "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 }) => { const bot = getBot(); const blockPos = new Vec3(x, y, z); const block = bot.blockAt(blockPos); if (!block || block.name === 'air') { return factory.createResponse(`No block found at position (${x}, ${y}, ${z})`); } if (!bot.canDigBlock(block) || !bot.canSeeBlock(block)) { const goal = new goals.GoalNear(x, y, z, 2); await bot.pathfinder.goto(goal); } await bot.dig(block); return factory.createResponse(`Dug ${block.name} at (${x}, ${y}, ${z})`); } );

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/yuniko-software/minecraft-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server