Skip to main content
Glama
zeeweebee

Minecraft MCP Server

by zeeweebee

move-in-direction

Control Minecraft bot movement by specifying direction and duration to navigate the game world.

Instructions

Move the bot in a specific direction for a duration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directionYesDirection to move
durationNoDuration in milliseconds (default: 1000)

Implementation Reference

  • The handler function that implements the tool logic: sets the Minecraft bot's control state for the given direction, waits for the specified duration using setTimeout, then stops the movement and returns success message. Handles errors by stopping movement.
    async ({ direction, duration = 1000 }: { direction: Direction, duration?: number }): Promise<McpResponse> => { return new Promise((resolve) => { try { bot.setControlState(direction, true); setTimeout(() => { bot.setControlState(direction, false); resolve(createResponse(`Moved ${direction} for ${duration}ms`)); }, duration); } catch (error) { bot.setControlState(direction, false); resolve(createErrorResponse(error as Error)); } }); }
  • Zod schema defining the input parameters for the 'move-in-direction' tool: required 'direction' as enum and optional 'duration' in ms.
    { direction: z.enum(['forward', 'back', 'left', 'right']).describe("Direction to move"), duration: z.number().optional().describe("Duration in milliseconds (default: 1000)") },
  • src/bot.ts:230-252 (registration)
    The MCP server.tool() call that registers the 'move-in-direction' tool, providing name, description, input schema, and inline handler function.
    server.tool( "move-in-direction", "Move the bot in a specific direction for a duration", { direction: z.enum(['forward', 'back', 'left', 'right']).describe("Direction to move"), duration: z.number().optional().describe("Duration in milliseconds (default: 1000)") }, async ({ direction, duration = 1000 }: { direction: Direction, duration?: number }): Promise<McpResponse> => { return new Promise((resolve) => { try { bot.setControlState(direction, true); setTimeout(() => { bot.setControlState(direction, false); resolve(createResponse(`Moved ${direction} for ${duration}ms`)); }, duration); } catch (error) { bot.setControlState(direction, false); resolve(createErrorResponse(error as Error)); } }); } );
  • TypeScript type definition for the 'Direction' enum used in the tool's handler signature and schema.
    type Direction = 'forward' | 'back' | 'left' | 'right';

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