Skip to main content
Glama

digBlock

Remove a block at specific coordinates in Minecraft by specifying X, Y, and Z values, enabling precise block manipulation for remote server gameplay.

Instructions

Dig a block at the specified coordinates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX coordinate
yYesY coordinate
zYesZ coordinate

Implementation Reference

  • The main handler function for the digBlock tool. It checks connection, fetches the block at coordinates, digs it using bot.dig(), 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 schema for 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'), },
  • The server.tool call that registers the digBlock tool with MCP server, including name, description, schema, and handler.
    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) } } )
  • Call to registerBlockTools() within registerAllTools(), which triggers the registration of digBlock and placeBlock tools.
    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