Skip to main content
Glama

move-in-direction

Control a Minecraft character's movement by specifying direction and duration. Use this tool to navigate the game world for exploration or building tasks.

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 bot's control state to move in the specified direction for the given duration using a Promise and setTimeout.
    async ({ direction, duration = 1000 }: { direction: Direction, duration?: number }) => { const bot = getBot(); return new Promise((resolve) => { bot.setControlState(direction, true); setTimeout(() => { bot.setControlState(direction, false); resolve(factory.createResponse(`Moved ${direction} for ${duration}ms`)); }, duration); }); }
  • Zod schema for input validation: direction as enum of movement directions, 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)") },
  • The factory.registerTool call that registers the 'move-in-direction' tool with its name, description, schema, and handler function.
    factory.registerTool( "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 }) => { const bot = getBot(); return new Promise((resolve) => { bot.setControlState(direction, true); setTimeout(() => { bot.setControlState(direction, false); resolve(factory.createResponse(`Moved ${direction} for ${duration}ms`)); }, duration); }); } );
  • Type alias for valid movement directions used in the handler's type annotation.
    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/yuniko-software/minecraft-mcp-server'

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