Skip to main content
Glama

openContainer

Access containers like chests or furnaces at specific coordinates in Minecraft to manage inventory and retrieve items.

Instructions

Open a container (chest, furnace, etc.) at specific coordinates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX coordinate of the container
yYesY coordinate of the container
zYesZ coordinate of the container

Implementation Reference

  • Executes the openContainer tool: checks bot connection, retrieves block at (x,y,z), validates it as a container type (chest, furnace, etc.), opens the container using bot.openContainer, stores it in botState.currentContainer, inventories non-null slots mapping to name/count/slot, formats response with contents list.
    async ({ x, y, z }) => {
      if (!botState.isConnected || !botState.bot) {
        return createNotConnectedResponse()
      }
    
      try {
        // Get the block at the coordinates
        const block = botState.bot.blockAt(new Vec3(x, y, z))
    
        if (!block) {
          return createSuccessResponse(
            `No block found at coordinates X=${x}, Y=${y}, Z=${z}`
          )
        }
    
        // Check if the block is a container
        if (
          !block.name.includes('chest') &&
          !block.name.includes('furnace') &&
          !block.name.includes('barrel') &&
          !block.name.includes('shulker') &&
          !block.name.includes('dispenser') &&
          !block.name.includes('dropper') &&
          !block.name.includes('hopper')
        ) {
          return createSuccessResponse(
            `Block at X=${x}, Y=${y}, Z=${z} is not a container (found: ${block.name})`
          )
        }
    
        // Open the container
        const container = await botState.bot.openContainer(block)
    
        // Store container reference as our Container type with withdraw/deposit methods
        botState.currentContainer = container as unknown as Container
    
        // Get container contents
        const items = container.slots
          .filter((item): item is NonNullable<typeof item> => item !== null)
          .map((item) => {
            if (!item) return null
            return {
              name: item.name,
              displayName: item.displayName || item.name,
              count: item.count || 1,
              slot: container.slots.indexOf(item),
            }
          })
          .filter((item) => item !== null)
    
        // Format the response
        let response = `Opened ${block.name} at X=${x}, Y=${y}, Z=${z}\n\n`
    
        if (items.length === 0) {
          response += 'Container is empty.'
        } else {
          response += `Container contains ${items.length} items:\n`
          items.forEach((item) => {
            response += `- ${item.displayName} (x${item.count}) in slot ${item.slot}\n`
          })
        }
    
        return createSuccessResponse(response)
      } catch (error) {
        return createErrorResponse(error)
      }
    }
  • Zod input schema for openContainer tool defining required numeric parameters x, y, z coordinates with descriptions.
    {
      x: z.number().describe('X coordinate of the container'),
      y: z.number().describe('Y coordinate of the container'),
      z: z.number().describe('Z coordinate of the container'),
    },
  • Registers the openContainer tool via server.tool call, specifying name, description, input schema, and handler function.
    server.tool(
      'openContainer',
      'Open a container (chest, furnace, etc.) at specific coordinates',
      {
        x: z.number().describe('X coordinate of the container'),
        y: z.number().describe('Y coordinate of the container'),
        z: z.number().describe('Z coordinate of the container'),
      },
      async ({ x, y, z }) => {
        if (!botState.isConnected || !botState.bot) {
          return createNotConnectedResponse()
        }
    
        try {
          // Get the block at the coordinates
          const block = botState.bot.blockAt(new Vec3(x, y, z))
    
          if (!block) {
            return createSuccessResponse(
              `No block found at coordinates X=${x}, Y=${y}, Z=${z}`
            )
          }
    
          // Check if the block is a container
          if (
            !block.name.includes('chest') &&
            !block.name.includes('furnace') &&
            !block.name.includes('barrel') &&
            !block.name.includes('shulker') &&
            !block.name.includes('dispenser') &&
            !block.name.includes('dropper') &&
            !block.name.includes('hopper')
          ) {
            return createSuccessResponse(
              `Block at X=${x}, Y=${y}, Z=${z} is not a container (found: ${block.name})`
            )
          }
    
          // Open the container
          const container = await botState.bot.openContainer(block)
    
          // Store container reference as our Container type with withdraw/deposit methods
          botState.currentContainer = container as unknown as Container
    
          // Get container contents
          const items = container.slots
            .filter((item): item is NonNullable<typeof item> => item !== null)
            .map((item) => {
              if (!item) return null
              return {
                name: item.name,
                displayName: item.displayName || item.name,
                count: item.count || 1,
                slot: container.slots.indexOf(item),
              }
            })
            .filter((item) => item !== null)
    
          // Format the response
          let response = `Opened ${block.name} at X=${x}, Y=${y}, Z=${z}\n\n`
    
          if (items.length === 0) {
            response += 'Container is empty.'
          } else {
            response += `Container contains ${items.length} items:\n`
            items.forEach((item) => {
              response += `- ${item.displayName} (x${item.count}) in slot ${item.slot}\n`
            })
          }
    
          return createSuccessResponse(response)
        } catch (error) {
          return createErrorResponse(error)
        }
      }
    )
  • Invokes registerContainerInteractionTools() within registerAllTools(), thereby registering the openContainer tool.
    registerContainerInteractionTools()
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('Open') but doesn't describe what happens after opening (e.g., does it show contents, require permissions, have side effects like triggering events, or affect game state). This leaves significant gaps for a mutation tool in a game context.

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 with no wasted words. It front-loads the core action and resource, making it immediately understandable.

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 what 'opening' entails (e.g., whether it returns container contents, triggers UI, or has latency), leaving the agent uncertain about the tool's full behavior and outcomes.

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 in the schema. The description adds minimal value beyond the schema by implying coordinates target a container location, but doesn't provide additional context like coordinate system, units, or range constraints.

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 ('Open') and resource ('container') with examples (chest, furnace) and specifies the target location ('at specific coordinates'). It distinguishes from obvious alternatives like 'closeContainer' but doesn't explicitly differentiate from other container-related tools like 'depositItem' or 'withdrawItem'.

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 to be near the container), when not to use it, or how it relates to sibling tools like 'closeContainer', 'depositItem', or 'withdrawItem'.

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