lookAt
Direct the player's gaze to any set of 3D coordinates, enabling precise control over the player's view direction for navigation or building tasks.
Instructions
Make the player look in a specific direction or at coordinates
Input 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:82-105 (handler)The tool handler for 'lookAt' - calls bot.lookAt() with Vec3 coordinates. Registered on line 83 via server.tool().
// Tool for looking in a direction 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) } } ) - src/tools/basicMovement.ts:86-90 (schema)Input schema for 'lookAt' - defines x, y, z as required numeric parameters using Zod.
{ 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/index.ts:22-22 (registration)Registration call - registerBasicMovementTools() is called within registerAllTools() to register all tools.
registerBasicMovementTools() - src/tools/basicMovement.ts:21-21 (registration)The registration function export. The 'lookAt' tool is registered inside this function via server.tool().
export function registerBasicMovementTools() { - src/utils/error-handler.ts:6-17 (helper)Helper functions used by the handler - createSuccessResponse, createErrorResponse, and createNotConnectedResponse.
export function createErrorResponse(error: unknown): ToolResponse { return { content: [ { type: 'text', text: `Error: ${ error instanceof Error ? error.message : String(error) }`, }, ], } }