Skip to main content
Glama

moveControl

Execute player movement commands in Minecraft through remote servers. Set actions like forward, back, left, right, jump, sprint, or sneak with adjustable duration for precise control.

Instructions

Control the player with basic movement commands

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesMovement action to perform
durationNoDuration to perform the action in seconds

Implementation Reference

  • Executes the moveControl tool by setting the bot's control states (forward, back, left, right, jump, sprint, sneak) for a specified duration or stopping all movement.
    async ({ action, duration }) => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { // Convert duration to milliseconds const durationMs = duration * 1000 // Execute the requested movement action if (action === 'stop') { // Stop all movement botState.bot.clearControlStates() return createSuccessResponse(`All movement stopped`) } else { // Handle movement actions // We know that the action is a valid control state at this point (not 'stop') const controlState = action as ControlState botState.bot.setControlState(controlState, true) // After specified duration, stop the action setTimeout(() => { if (botState.bot) { botState.bot.setControlState(controlState, false) } }, durationMs) return createSuccessResponse( `Performing action: ${action} for ${duration} seconds` ) } } catch (error) { return createErrorResponse(error) } }
  • Zod input schema for the moveControl tool defining 'action' enum and optional 'duration' parameter.
    action: z .enum([ 'forward', 'back', 'left', 'right', 'jump', 'sprint', 'sneak', 'stop', ] as const) .describe('Movement action to perform'), duration: z .number() .optional() .default(1) .describe('Duration to perform the action in seconds'), },
  • Registers the 'moveControl' tool using server.tool with description, input schema, and handler function.
    server.tool( 'moveControl', 'Control the player with basic movement commands', { action: z .enum([ 'forward', 'back', 'left', 'right', 'jump', 'sprint', 'sneak', 'stop', ] as const) .describe('Movement action to perform'), duration: z .number() .optional() .default(1) .describe('Duration to perform the action in seconds'), }, async ({ action, duration }) => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { // Convert duration to milliseconds const durationMs = duration * 1000 // Execute the requested movement action if (action === 'stop') { // Stop all movement botState.bot.clearControlStates() return createSuccessResponse(`All movement stopped`) } else { // Handle movement actions // We know that the action is a valid control state at this point (not 'stop') const controlState = action as ControlState botState.bot.setControlState(controlState, true) // After specified duration, stop the action setTimeout(() => { if (botState.bot) { botState.bot.setControlState(controlState, false) } }, durationMs) return createSuccessResponse( `Performing action: ${action} for ${duration} seconds` ) } } catch (error) { return createErrorResponse(error) } } )
  • Type definition for valid control states used in the moveControl handler.
    type ControlState = | 'forward' | 'back' | 'left' | 'right' | 'jump' | 'sprint' | 'sneak'

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