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
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Movement action to perform | |
| duration | No | Duration to perform the action in seconds |
Implementation Reference
- src/tools/basicMovement.ts:45-79 (handler)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) } }
- src/tools/basicMovement.ts:27-44 (schema)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'), },
- src/tools/basicMovement.ts:23-80 (registration)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) } } )
- src/tools/basicMovement.ts:11-18 (helper)Type definition for valid control states used in the moveControl handler.type ControlState = | 'forward' | 'back' | 'left' | 'right' | 'jump' | 'sprint' | 'sneak'