Skip to main content
Glama

fly-to

Navigate to specific coordinates in Minecraft by providing X, Y, and Z values for precise positioning.

Instructions

Make the bot fly to a specific position

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX coordinate
yYesY coordinate
zYesZ coordinate

Implementation Reference

  • Handler function for the 'fly-to' tool. Uses bot.creative.flyTo to fly to the specified coordinates with timeout and cancellation support.
    async ({ x, y, z }) => {
      const bot = getBot();
    
      if (!bot.creative) {
        return factory.createResponse("Creative mode is not available. Cannot fly.");
      }
    
      const controller = new AbortController();
      const FLIGHT_TIMEOUT_MS = 20000;
    
      const timeoutId = setTimeout(() => {
        if (!controller.signal.aborted) {
          controller.abort();
        }
      }, FLIGHT_TIMEOUT_MS);
    
      try {
        const destination = new Vec3(x, y, z);
        await createCancellableFlightOperation(bot, destination, controller);
        return factory.createResponse(`Successfully flew to position (${x}, ${y}, ${z}).`);
      } catch (error) {
        if (controller.signal.aborted) {
          const currentPosAfterTimeout = bot.entity.position;
          return factory.createErrorResponse(
            `Flight timed out after ${FLIGHT_TIMEOUT_MS / 1000} seconds. The destination may be unreachable. ` +
            `Current position: (${Math.floor(currentPosAfterTimeout.x)}, ${Math.floor(currentPosAfterTimeout.y)}, ${Math.floor(currentPosAfterTimeout.z)})`
          );
        }
        throw error;
      } finally {
        clearTimeout(timeoutId);
        bot.creative.stopFlying();
      }
    }
  • Input schema for 'fly-to' tool using Zod, defining x, y, z coordinates as numbers.
      x: z.number().describe("X coordinate"),
      y: z.number().describe("Y coordinate"),
      z: z.number().describe("Z coordinate")
    },
  • Registers the 'fly-to' tool with the ToolFactory, including name, description, schema, and handler.
    factory.registerTool(
      "fly-to",
      "Make the bot fly to a specific position",
      {
        x: z.number().describe("X coordinate"),
        y: z.number().describe("Y coordinate"),
        z: z.number().describe("Z coordinate")
      },
      async ({ x, y, z }) => {
        const bot = getBot();
    
        if (!bot.creative) {
          return factory.createResponse("Creative mode is not available. Cannot fly.");
        }
    
        const controller = new AbortController();
        const FLIGHT_TIMEOUT_MS = 20000;
    
        const timeoutId = setTimeout(() => {
          if (!controller.signal.aborted) {
            controller.abort();
          }
        }, FLIGHT_TIMEOUT_MS);
    
        try {
          const destination = new Vec3(x, y, z);
          await createCancellableFlightOperation(bot, destination, controller);
          return factory.createResponse(`Successfully flew to position (${x}, ${y}, ${z}).`);
        } catch (error) {
          if (controller.signal.aborted) {
            const currentPosAfterTimeout = bot.entity.position;
            return factory.createErrorResponse(
              `Flight timed out after ${FLIGHT_TIMEOUT_MS / 1000} seconds. The destination may be unreachable. ` +
              `Current position: (${Math.floor(currentPosAfterTimeout.x)}, ${Math.floor(currentPosAfterTimeout.y)}, ${Math.floor(currentPosAfterTimeout.z)})`
            );
          }
          throw error;
        } finally {
          clearTimeout(timeoutId);
          bot.creative.stopFlying();
        }
      }
    );
  • src/main.ts:56-56 (registration)
    Calls registerFlightTools in main to initialize and register all flight tools including 'fly-to'.
    registerFlightTools(factory, getBot);
  • Helper utility that makes the flight operation cancellable via AbortController.
    function createCancellableFlightOperation(
      bot: mineflayer.Bot,
      destination: Vec3,
      controller: AbortController
    ): Promise<boolean> {
      return new Promise((resolve, reject) => {
        let aborted = false;
    
        controller.signal.addEventListener('abort', () => {
          aborted = true;
          bot.creative.stopFlying();
          reject(new Error("Flight operation cancelled"));
        });
    
        bot.creative.flyTo(destination)
          .then(() => {
            if (!aborted) {
              resolve(true);
            }
          })
          .catch((err: Error) => {
            if (!aborted) {
              reject(err);
            }
          });
      });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action but doesn't describe what happens during execution (e.g., flight path, speed, collision handling), whether it's blocking or async, error behavior, or any side effects. 'Fly to' implies movement but lacks operational details needed for safe invocation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core action and target, making it easy to parse. Every word earns its place, and there's no redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a movement tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'fly' entails operationally, what the bot does upon arrival, potential failures, or return values. For a 3-parameter action tool in a gaming/robotics context, more behavioral context is needed to ensure correct use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with all three parameters (x, y, z) clearly documented as coordinates. The description adds no additional parameter semantics beyond what's in the schema—it doesn't specify coordinate systems, units, valid ranges, or positional constraints. The baseline of 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('fly to') and target ('a specific position'), making the purpose immediately understandable. It distinguishes from siblings like 'move-to-position' by specifying flying rather than walking, though it doesn't explicitly contrast them. The verb+resource combination is specific but could be more detailed about the bot context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'move-to-position' or 'jump'. There's no mention of prerequisites (e.g., whether the bot needs to be in a fly-capable state), performance considerations, or error conditions. Usage is implied by the action but not explicitly contextualized.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/yuniko-software/minecraft-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server