Skip to main content
Glama
bellsanct
by bellsanct

unequip_item

Remove an equipped item from a character's slot and return it to inventory in the MCP Dungeon Game. Specify the slot (weapon, shield, armor, or accessory) and save key to manage equipment.

Instructions

特定のスロットからアイテムを外してインベントリに戻します。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slotYes装備スロット: weapon, shield, armor, または accessory
save_keyYesセーブキー

Implementation Reference

  • The logic for the 'unequip_item' tool, which validates the player state, checks the equipment slot, moves the item back to the inventory, and saves the game data.
    export async function unequipItem(slot: string, saveKey: string): Promise<string> {
      const data = await storage.load(saveKey);
      
      if (!data.player.name) {
        return "プレイヤーが見つかりません。先に'create_player'を実行してください。";
      }
    
      if (data.player.state === 'exploring') {
        return "ダンジョン探索中は装備を変更できません。\n探索完了後に装備を整えてください。";
      }
    
      const validSlots = ['weapon', 'shield', 'armor', 'accessory'];
      if (!validSlots.includes(slot)) {
        return `無効なスロットです。有効なスロット: ${validSlots.join(', ')}`;
      }
    
      const slotKey = slot as keyof typeof data.player.equipment;
      const item = data.player.equipment[slotKey];
    
      if (!item) {
        return `${slot}スロットには何も装備されていません。`;
      }
    
      // Type guard: Ensure we only push Equipment to equipment inventory
      if (!('stats' in item)) {
        return `エラー: ${slot}スロットに装備アイテムがありません。`;
      }
    
      // インベントリに移動
      data.player.inventory.push(item as Equipment);
      data.player.equipment[slotKey] = null;
    
      await storage.save(data, saveKey);
    
      const slotNames: { [key: string]: string } = {
        weapon: '武器',
        shield: '盾',
        armor: '防具',
        accessory: 'アクセサリ'
      };
    
      return `${slotNames[slot]}スロットから${item.name}を外しました。`;
    }
  • src/index.ts:108-123 (registration)
    Registration of the 'unequip_item' tool including its input schema and description.
    {
      name: 'unequip_item',
      description: '特定のスロットからアイテムを外してインベントリに戻します。',
      inputSchema: {
        type: 'object',
        properties: {
          slot: {
            type: 'string',
            description: '装備スロット: weapon, shield, armor, または accessory',
            enum: ['weapon', 'shield', 'armor', 'accessory'],
          },
          save_key: {
            type: 'string',
            description: 'セーブキー',
          },
        },

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/bellsanct/mcp-dungeon-game'

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