Skip to main content
Glama

getPosition

Retrieve the player's current coordinates in the Minecraft world to enable navigation, building, and location tracking.

Instructions

Get the current position of the player in the Minecraft world

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the getPosition tool. It checks if the bot is connected, retrieves the bot's entity position, formats it into a string, and returns a success response.
    async () => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { const position = botState.bot.entity.position return createSuccessResponse( `Current position: X=${position.x.toFixed(2)}, Y=${position.y.toFixed( 2 )}, Z=${position.z.toFixed(2)}` ) } catch (error) { return createErrorResponse(error) } }
  • Registers the getPosition tool using server.tool method, with description, empty input schema, and inline handler function.
    server.tool( 'getPosition', 'Get the current position of the player in the Minecraft world', {}, async () => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { const position = botState.bot.entity.position return createSuccessResponse( `Current position: X=${position.x.toFixed(2)}, Y=${position.y.toFixed( 2 )}, Z=${position.z.toFixed(2)}` ) } catch (error) { return createErrorResponse(error) } } )

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