lookAt
Control a player’s view by directing them to look at specific X, Y, and Z coordinates in Minecraft, enhancing navigation and interaction tasks on remote servers.
Instructions
Make the player look in a specific direction or at coordinates
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | X coordinate to look at | |
| y | Yes | Y coordinate to look at | |
| z | Yes | Z coordinate to look at |
Implementation Reference
- src/tools/basicMovement.ts:91-104 (handler)The main handler function for the 'lookAt' tool. It validates bot connection, calls bot.lookAt with Vec3 coordinates, and returns appropriate success or error responses.async ({ x, y, z }) => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { await botState.bot.lookAt(new Vec3(x, y, z)) return createSuccessResponse( `Looking at coordinates: X=${x}, Y=${y}, Z=${z}` ) } catch (error) { return createErrorResponse(error) } }
- src/tools/basicMovement.ts:86-90 (schema)Input schema using Zod for validating x, y, z numeric coordinates.{ x: z.number().describe('X coordinate to look at'), y: z.number().describe('Y coordinate to look at'), z: z.number().describe('Z coordinate to look at'), },
- src/tools/basicMovement.ts:83-105 (registration)Registration of the 'lookAt' tool via server.tool, including name, description, input schema, and handler function.server.tool( 'lookAt', 'Make the player look in a specific direction or at coordinates', { x: z.number().describe('X coordinate to look at'), y: z.number().describe('Y coordinate to look at'), z: z.number().describe('Z coordinate to look at'), }, async ({ x, y, z }) => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { await botState.bot.lookAt(new Vec3(x, y, z)) return createSuccessResponse( `Looking at coordinates: X=${x}, Y=${y}, Z=${z}` ) } catch (error) { return createErrorResponse(error) } } )