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回復)やおまもり(イベント回避)があります。
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"item_id": "<item_id>",
"slot": "<slot>",
"save_key": "<save_key>"
},
"name": "equip_holding_item"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item_id | Yes | 装備する持ち物のID(インベントリに表示) | |
| slot | Yes | 持ち物スロット: item1 または item2 | |
| save_key | Yes | セーブキー |
Implementation Reference
- src/tools/player.ts:281-313 (handler)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}`; }