lookAt
Control player view direction in Minecraft by specifying exact coordinates to look at, enabling precise targeting for navigation and interaction tasks.
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 handler function for the 'lookAt' tool. Checks if bot is connected, then uses bot.lookAt to direct the bot's gaze at the specified (x,y,z) coordinates, returning success or error response.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 for the 'lookAt' tool using Zod, defining required numeric parameters x, y, z 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 description, input schema, and inline 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) } } )