Skip to main content
Glama

find-entity

Locate the nearest entity of a specified type in Minecraft, such as mobs or items, within a defined search radius to interact with or avoid game elements.

Instructions

Find the nearest entity of a specific type

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNoType of entity to find (empty for any entity)
maxDistanceNoMaximum search distance (default: 16)

Implementation Reference

  • The core handler function for the 'find-entity' tool. It uses the bot's nearestEntity method with a type filter and checks if within maxDistance, returning entity details or a message if none found.
    async ({ type = '', maxDistance = 16 }) => {
      const bot = getBot();
      const entityFilter = (entity: NonNullable<Entity>) => {
        if (!type) return true;
        if (type === 'player') return entity.type === 'player';
        if (type === 'mob') return entity.type === 'mob';
        return Boolean(entity.name && entity.name.includes(type.toLowerCase()));
      };
    
      const entity = bot.nearestEntity(entityFilter);
    
      if (!entity || bot.entity.position.distanceTo(entity.position) > maxDistance) {
        return factory.createResponse(`No ${type || 'entity'} found within ${maxDistance} blocks`);
      }
    
      const entityName = entity.name || (entity as { username?: string }).username || entity.type;
      return factory.createResponse(`Found ${entityName} at position (${Math.floor(entity.position.x)}, ${Math.floor(entity.position.y)}, ${Math.floor(entity.position.z)})`);
    }
  • Input schema definition using Zod for the tool's parameters: optional 'type' string and 'maxDistance' number.
    {
      type: z.string().optional().describe("Type of entity to find (empty for any entity)"),
      maxDistance: z.number().optional().describe("Maximum search distance (default: 16)")
    },
  • Registers the 'find-entity' tool with the ToolFactory, including name, description, schema, and handler function.
    factory.registerTool(
      "find-entity",
      "Find the nearest entity of a specific type",
      {
        type: z.string().optional().describe("Type of entity to find (empty for any entity)"),
        maxDistance: z.number().optional().describe("Maximum search distance (default: 16)")
      },
      async ({ type = '', maxDistance = 16 }) => {
        const bot = getBot();
        const entityFilter = (entity: NonNullable<Entity>) => {
          if (!type) return true;
          if (type === 'player') return entity.type === 'player';
          if (type === 'mob') return entity.type === 'mob';
          return Boolean(entity.name && entity.name.includes(type.toLowerCase()));
        };
    
        const entity = bot.nearestEntity(entityFilter);
    
        if (!entity || bot.entity.position.distanceTo(entity.position) > maxDistance) {
          return factory.createResponse(`No ${type || 'entity'} found within ${maxDistance} blocks`);
        }
    
        const entityName = entity.name || (entity as { username?: string }).username || entity.type;
        return factory.createResponse(`Found ${entityName} at position (${Math.floor(entity.position.x)}, ${Math.floor(entity.position.y)}, ${Math.floor(entity.position.z)})`);
      }
    );
  • src/main.ts:54-54 (registration)
    Top-level invocation of registerEntityTools in the main application, which registers the 'find-entity' tool among others.
    registerEntityTools(factory, getBot);
  • Type definition for Entity used in the handler's filter function.
    type Entity = ReturnType<Bot['nearestEntity']>;
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without behavioral details. It doesn't disclose what happens if no entity is found, whether it requires specific permissions or game states, or any rate limits. This leaves critical operational context missing for a tool that likely interacts with a game environment.

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, clear sentence with zero waste. It's front-loaded with the core action and appropriately sized for the tool's apparent complexity, making it easy to parse quickly.

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 no annotations and no output schema, the description is incomplete. It lacks details on return values, error conditions, and behavioral traits like what 'nearest' means in practice. For a tool with potential game-world interactions, this leaves too many gaps for reliable agent 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%, so the schema fully documents the two parameters (type and maxDistance). The description adds no additional meaning beyond implying 'nearest' relates to distance, which is already covered by the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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

Purpose3/5

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

The description states the tool finds the nearest entity of a specific type, which provides a basic purpose. However, it's vague about what 'entity' means in this context (e.g., mobs, players, items) and doesn't distinguish it from sibling tools like 'find-block' or 'find-item', leaving ambiguity in scope.

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?

No guidance is provided on when to use this tool versus alternatives like 'find-block' or 'find-item'. The description implies usage for locating entities but offers no context on prerequisites, exclusions, or specific scenarios, leaving the agent to guess based on tool names alone.

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