Skip to main content
Glama
leo4life2

Minecraft MCP Server

by leo4life2

dropItem

Remove items from inventory by specifying the item name and optionally the count or target player. Simplifies inventory management in Minecraft MCP Server for AI agents.

Instructions

Drop items from inventory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoOptional: Number of items to drop (default: all)
nameYesName of the item to drop
userNameNoOptional: Drop near a specific player

Implementation Reference

  • The main handler function that implements the dropItem tool logic: validates parameters, finds the item in inventory, optionally tosses towards a player, and drops the specified count of items using bot.toss().
    export const dropItem = async (
      bot: Bot,
      params: ISkillParams,
      serviceParams: ISkillServiceParams,
    ): Promise<boolean> => {
      const skillName = 'dropItem';
      const requiredParams = ['name'];
      const isParamsValid = validateSkillParams(
        params,
        requiredParams,
        skillName,
      );
      if (!isParamsValid) {
        serviceParams.cancelExecution?.();
        bot.emit(
          'alteraBotEndObservation',
          `Mistake: You didn't provide all of the required parameters ${requiredParams.join(', ')} for the ${skillName} skill.`,
        );
        return false;
      }
      const { getStatsData, setStatsData } = serviceParams;
    
      const unpackedParams = {
        name: params.name,
        count: params.count ?? 1,
        playerName: params.userName ?? null,
        signal: serviceParams.signal,
      };
    
      if (
        unpackedParams.playerName != null &&
        unpackedParams.playerName != bot.username
      ) {
        return tossItemTowardsPlayer(bot, {
          playerName: unpackedParams.playerName,
          itemName: unpackedParams.name,
          itemCount: unpackedParams.count,
          signal: serviceParams.signal,
        });
      }
    
      // Find the closest item name from the input
      const closestItemName = findClosestItemName(bot, { name: unpackedParams.name });
      if (!closestItemName) {
        return bot.emit(
          'alteraBotEndObservation',
          `Error: There's no item named ${unpackedParams.name} in minecraft.`,
        );
      }
      unpackedParams.name = closestItemName;
    
      // Find the item in the bot's inventory
      const itemToDrop = bot.inventory
        .items()
        .find((item) => item.name === unpackedParams.name);
    
      if (!itemToDrop) {
        return bot.emit(
          'alteraBotEndObservation',
          `mistake: You don't have '${unpackedParams.name}'.`,
        );
      }
    
      try {
        // Drop the item
        const dropItemCount = Math.min(
          unpackedParams.count,
          countItems(bot, unpackedParams.name),
        );
        const tossFn = async function () {
          return bot.toss(itemToDrop.type, null, dropItemCount);
        };
        await asyncwrap({ func: tossFn, getStatsData, setStatsData });
        return bot.emit(
          'alteraBotEndObservation',
          `You dropped ${dropItemCount} ${unpackedParams.name}.`,
        );
      } catch (err) {
        const error = err as Error;
        console.log(`dropItem Error: ${error.message}`);
        return bot.emit(
          'alteraBotEndObservation',
          `You failed to drop ${unpackedParams.name}.`,
        );
      }
    };
  • The input schema definition for the dropItem tool, including parameters, descriptions, and required fields.
    dropItem: {
        description: "Drop items from inventory",
        params: {
            name: { type: "string", description: "Name of the item to drop" },
            count: { type: "number", description: "Optional: Number of items to drop (default: all)" },
            userName: { type: "string", description: "Optional: Drop near a specific player" }
        },
        required: ["name"]
    },
  • Registration of the dropItem tool in SKILL_METADATA, which is used by loadSkills() to create and register the SkillDefinition.
    dropItem: {
        description: "Drop items from inventory",
        params: {
            name: { type: "string", description: "Name of the item to drop" },
            count: { type: "number", description: "Optional: Number of items to drop (default: all)" },
            userName: { type: "string", description: "Optional: Drop near a specific player" }
        },
        required: ["name"]
    },
  • Helper function to count the total number of a specific item in the bot's inventory, used to limit the drop count.
    const countItems = (bot: Bot, itemName: string) => {
      return bot.inventory.items().reduce((total, item) => {
        return item.name === itemName ? total + item.count : total;
      }, 0);
    };
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 basic action. It doesn't disclose behavioral traits such as whether dropping is permanent, if items can be retrieved, what happens when dropped near a player (e.g., visibility or ownership), or any rate limits. 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.

Conciseness4/5

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

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core action, though it could be slightly more informative given the lack of other context. It earns its place but leaves room for improvement in clarity.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain the outcome (e.g., where items go, if they're destroyed, or return values), behavioral constraints, or error conditions. Given the complexity of dropping items in a game context, more detail is needed to guide an agent effectively.

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 parameters are well-documented in the schema. The description adds no additional meaning beyond implying the action involves items from inventory, which is already inferred from the tool name and parameter 'name'. Baseline score of 3 is appropriate as the schema handles parameter semantics adequately.

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 'Drop items from inventory' clearly states the action (drop) and target (items from inventory), but it's somewhat vague about scope and doesn't differentiate from sibling tools like 'giveItemToSomeone' or 'placeItemNearYou' which also involve item disposition. It specifies the source (inventory) but lacks detail about destination or effect.

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. The description doesn't mention prerequisites (e.g., needing items in inventory), exclusions (e.g., cannot drop equipped items), or compare to siblings like 'giveItemToSomeone' for transferring items to others or 'placeItemNearYou' for placing items in the world.

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

Related 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/leo4life2/minecraft-mcp-http'

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