teleport
Move players or entities to specific coordinates or other entities in Minecraft servers using target selectors and coordinate inputs.
Instructions
Teleport a player or entity to coordinates or another entity.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | Target selector (e.g., '@a', '@p', 'PlayerName') | |
| x | No | X coordinate | |
| y | No | Y coordinate | |
| z | No | Z coordinate | |
| destination | No | Destination entity/player name (alternative to coordinates) |
Implementation Reference
- src/tools/command-tools.ts:270-290 (handler)The handler function for the 'teleport' tool, which constructs and executes the Minecraft 'tp' command.
async ({ target, x, y, z: zCoord, destination }) => { let cmd: string; if (destination) { cmd = `tp ${target} ${destination}`; } else if (x !== undefined && y !== undefined && zCoord !== undefined) { cmd = `tp ${target} ${x} ${y} ${zCoord}`; } else { return { content: [ { type: "text", text: "Provide either coordinates (x, y, z) or a destination entity.", }, ], isError: true, }; } try { const response = await manager.rcon.send(cmd); return { content: [{ type: "text", text: response }] }; } catch (error) { - src/tools/command-tools.ts:258-269 (schema)The Zod schema definition for the 'teleport' tool input parameters.
{ target: z .string() .describe("Target selector (e.g., '@a', '@p', 'PlayerName')"), x: z.number().optional().describe("X coordinate"), y: z.number().optional().describe("Y coordinate"), z: z.number().optional().describe("Z coordinate"), destination: z .string() .optional() .describe("Destination entity/player name (alternative to coordinates)"), }, - src/tools/command-tools.ts:255-257 (registration)Registration of the 'teleport' tool with the MCP server.
server.tool( "teleport", "Teleport a player or entity to coordinates or another entity.",