add_inventory_item
Record a new inventory item, specifying its name and initial holder, with optional description and chapter acquired, to maintain continuity across book chapters.
Instructions
Track an inventory item.
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": {
"name": "<name>",
"initial_holder": "<initial_holder>"
},
"name": "add_inventory_item"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| initial_holder | Yes | ||
| description | No | ||
| acquired_chapter | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/storywright_mcp/workflow.py:229-246 (handler)The actual handler/logic for add_inventory_item — creates an InventoryItem and appends it to the continuity log.
def add_inventory_item( name: str, initial_holder: str, description: str = "", acquired_chapter: int | None = None, ) -> str: _, cont = require_project() cont.inventory.append( InventoryItem( name=name, description=description, acquired_chapter=acquired_chapter, current_holder=initial_holder, original_holder=initial_holder, ) ) save_project_and_continuity() return f"Item {name} → {initial_holder}" - The InventoryItem dataclass schema with fields: name, description, acquired_chapter, transferred_chapter, current_holder, original_holder.
@dataclass class InventoryItem: name: str description: str = "" acquired_chapter: int | None = None transferred_chapter: int | None = None current_holder: str | None = None original_holder: str | None = None - src/storywright_mcp/app.py:119-127 (registration)The MCP tool registration via @mcp.tool() decorator that exposes add_inventory_item as a tool.
@mcp.tool() async def add_inventory_item( name: str, initial_holder: str, description: str = "", acquired_chapter: int | None = None, ) -> str: """Track an inventory item.""" return workflow.add_inventory_item(name, initial_holder, description, acquired_chapter) - Helper method get_item on ContinuityLog to look up an InventoryItem by name.
def get_item(self, name: str) -> InventoryItem | None: for item in self.inventory: if item.name == name: return item return None - ContinuityLog dataclass holding the inventory list (list[InventoryItem]) where items are stored.
@dataclass class ContinuityLog: living_characters: list[CharacterState] = field(default_factory=list) inventory: list[InventoryItem] = field(default_factory=list) running_gags: list[RunningGagStatus] = field(default_factory=list) locations_visited: list[LocationVisit] = field(default_factory=list) established_facts: list[EstablishedFact] = field(default_factory=list) revision_notes: list[RevisionNote] = field(default_factory=list) last_updated: str = field(default_factory=lambda: datetime.now().isoformat())