Skip to main content
Glama
bellsanct
by bellsanct

equip_holding_item

Equip consumable items from inventory to use during dungeon exploration. Items include healing herbs for HP recovery and charms to avoid random events.

Instructions

インベントリから持ち物を装備します。持ち物には薬草(HP回復)やおまもり(イベント回避)があります。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
item_idYes装備する持ち物のID(インベントリに表示)
slotYes持ち物スロット: item1 または item2
save_keyYesセーブキー

Implementation Reference

  • Implementation of equipHoldingItem, which assigns an item from the item inventory to one of the player's holding slots (item1 or item2).
    export async function equipHoldingItem(itemId: string, slot: 'item1' | 'item2', 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 itemIndex = data.player.itemInventory.findIndex(item => item.id === itemId);
    
      if (itemIndex === -1) {
        return `ID '${itemId}' の持ち物がインベントリに見つかりません。`;
      }
    
      const item = data.player.itemInventory[itemIndex];
    
      // 現在装備中のアイテムがあれば外す
      if (data.player.equipment[slot]) {
        const currentItem = data.player.equipment[slot] as Item;
        data.player.itemInventory.push(currentItem);
      }
    
      // 新しいアイテムを装備
      data.player.equipment[slot] = item;
      data.player.itemInventory.splice(itemIndex, 1);
    
      await storage.save(data, saveKey);
    
      return `${item.name}を${slot === 'item1' ? '持ち物1' : '持ち物2'}スロットに装備しました!\n効果: ${item.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