Skip to main content
Glama

digBlock

Remove blocks at specific coordinates in Minecraft to clear terrain, create structures, or mine resources using coordinate-based targeting.

Instructions

Dig a block at the specified coordinates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX coordinate
yYesY coordinate
zYesZ coordinate

Implementation Reference

  • The main handler logic for the digBlock tool. It checks connection, retrieves the block at (x,y,z), digs it if present, handles promises, errors, and includes a 30-second timeout.
    async ({ x, y, z }) => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { // Get block at specified coordinates const block = botState.bot.blockAt(new Vec3(x, y, z)) if (!block || block.name === 'air') { return createSuccessResponse( 'No block found at the specified coordinates.' ) } return new Promise<ToolResponse>((resolve) => { // Dig the block botState .bot!.dig(block) .then(() => { resolve( createSuccessResponse( `Successfully dug ${block.name} at X=${x}, Y=${y}, Z=${z}` ) ) }) .catch((err) => { resolve(createErrorResponse(err)) }) // Timeout handling (if still digging after 30 seconds) setTimeout(() => { resolve( createSuccessResponse( 'Digging is taking longer than expected. Still trying...' ) ) }, 30000) }) } catch (error) { return createErrorResponse(error) } }
  • Zod input schema defining required number parameters for x, y, z coordinates.
    { x: z.number().describe('X coordinate'), y: z.number().describe('Y coordinate'), z: z.number().describe('Z coordinate'), },
  • Registers the digBlock tool with server.tool, including name, description, input schema, and handler function.
    server.tool( 'digBlock', 'Dig a block at the specified coordinates', { x: z.number().describe('X coordinate'), y: z.number().describe('Y coordinate'), z: z.number().describe('Z coordinate'), }, async ({ x, y, z }) => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { // Get block at specified coordinates const block = botState.bot.blockAt(new Vec3(x, y, z)) if (!block || block.name === 'air') { return createSuccessResponse( 'No block found at the specified coordinates.' ) } return new Promise<ToolResponse>((resolve) => { // Dig the block botState .bot!.dig(block) .then(() => { resolve( createSuccessResponse( `Successfully dug ${block.name} at X=${x}, Y=${y}, Z=${z}` ) ) }) .catch((err) => { resolve(createErrorResponse(err)) }) // Timeout handling (if still digging after 30 seconds) setTimeout(() => { resolve( createSuccessResponse( 'Digging is taking longer than expected. Still trying...' ) ) }, 30000) }) } catch (error) { return createErrorResponse(error) } } )
  • Calls registerBlockTools() which in turn registers the digBlock tool among others.
    registerBlockTools()

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/nacal/mcp-minecraft-remote'

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