Skip to main content
Glama

useOnEntity

Apply a held item to a specific entity in Minecraft by providing its entity ID, enabling targeted interactions like feeding animals or activating mechanisms.

Instructions

Use held item on a specific entity

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entityIdYesID of the entity to use item on

Implementation Reference

  • Executes the 'useOnEntity' tool: validates connection, retrieves entity by ID, uses the bot's held item on the entity via bot.useOn(entity), and returns success or error response.
      async ({ entityId }) => {
        if (!botState.isConnected || !botState.bot) {
          return createNotConnectedResponse()
        }
    
        try {
          // Find the entity by ID
          const entity = botState.bot.entities[entityId]
          if (!entity) {
            return createSuccessResponse(`Entity with ID ${entityId} not found.`)
          }
    
          // Use current item on the entity
          await botState.bot.useOn(entity)
          const heldItem = botState.bot.heldItem
            ? botState.bot.heldItem.name
            : 'hand'
    
          return createSuccessResponse(
            `Used ${heldItem} on entity: ${
              entity.name || entity.username || 'Unknown entity'
            } (ID: ${entityId})`
          )
        } catch (error) {
          return createErrorResponse(error)
        }
      }
    )
  • Zod input schema for 'useOnEntity' tool defining the required entityId parameter.
    {
      entityId: z.number().describe('ID of the entity to use item on'),
    },
  • Registers the 'useOnEntity' MCP tool with server.tool, providing name, description, input schema, and handler function.
    server.tool(
      'useOnEntity',
      'Use held item on a specific entity',
      {
        entityId: z.number().describe('ID of the entity to use item on'),
      },
      async ({ entityId }) => {
        if (!botState.isConnected || !botState.bot) {
          return createNotConnectedResponse()
        }
    
        try {
          // Find the entity by ID
          const entity = botState.bot.entities[entityId]
          if (!entity) {
            return createSuccessResponse(`Entity with ID ${entityId} not found.`)
          }
    
          // Use current item on the entity
          await botState.bot.useOn(entity)
          const heldItem = botState.bot.heldItem
            ? botState.bot.heldItem.name
            : 'hand'
    
          return createSuccessResponse(
            `Used ${heldItem} on entity: ${
              entity.name || entity.username || 'Unknown entity'
            } (ID: ${entityId})`
          )
        } catch (error) {
          return createErrorResponse(error)
        }
      }
    )
  • Top-level registration call within registerAllTools() that invokes the entity interaction tools registration, including 'useOnEntity'.
    registerEntityInteractionTools()
  • src/index.ts:7-7 (registration)
    Ultimate registration point calling registerAllTools(), which chains to 'useOnEntity' tool registration.
    registerAllTools()
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'held item' but doesn't disclose behavioral traits such as whether this consumes the item, requires specific item types, has side effects like triggering events, or handles errors if no item is held. This leaves significant gaps for a mutation tool.

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 is front-loaded with the core action. There is no wasted text, making it appropriately sized for the tool's apparent complexity.

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, no output schema, and a mutation tool with potential behavioral complexity, the description is incomplete. It lacks details on outcomes, error conditions, or item interactions, which are critical for an agent to use this tool correctly in context with many sibling tools.

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 the parameter 'entityId' clearly documented in the schema. The description adds no additional meaning beyond implying the entity is the target, so it meets the baseline of 3 without compensating for any schema gaps.

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 action ('use held item') and target ('on a specific entity'), which clarifies the basic purpose. However, it's vague about what 'use' means operationally and doesn't differentiate from siblings like 'attackEntity' or 'equipItem' that might involve similar interactions with entities.

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. With many sibling tools involving entity interactions (e.g., attackEntity, followEntity, tradeWithVillager), the description lacks context about appropriate scenarios, prerequisites like holding an item, or exclusions.

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/nacal/mcp-minecraft-remote'

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