add_location
Add a location to a specific chapter in your book project, with an optional description, to organize settings and track continuity in the writing pipeline.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chapter | Yes | ||
| location | Yes | ||
| description | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/storywright_mcp/app.py:283-288 (handler)FastMCP tool decorator registration for 'add_location' - async handler that delegates to workflow.add_location and catches ValueError.
@mcp.tool() async def add_location(chapter: int, location: str, description: str = "") -> str: try: return workflow.add_location(chapter, location, description) except ValueError as e: return str(e) - src/storywright_mcp/workflow.py:573-577 (handler)Core business logic: loads the current project/continuity, appends a LocationVisit to locations_visited, saves, and returns confirmation string.
def add_location(chapter: int, location: str, description: str = "") -> str: _, cont = require_project() cont.locations_visited.append(LocationVisit(chapter=chapter, location=location, description=description)) save_project_and_continuity() return f"Location recorded: {location}" - LocationVisit dataclass schema defining the data model used by add_location - chapter (int), location (str), description (str).
@dataclass class LocationVisit: chapter: int location: str description: str = "" - Import of LocationVisit from models.continuity used by the add_location function.
from .revision_queue import append_revision, format_revision_section from .models.continuity import ( CharacterState, CharacterStatus, ContinuityLog, EstablishedFact, InventoryItem, LocationVisit, ) from .models.project import ( ChapterStatus, Character, DeathEntry, ProjectConfig, RunningGag, ) from .session import bind_project, require_project, save_project_and_continuity from .templates.defaults import get_default_comedy_brief, get_default_editor_brief, get_default_writer_brief def create_book_project( project_name: str, book_title: str, genre: str = "", authors: list[str] | None = None, projects_root: str | None = None, third_agents: list[str] | None = None, ) -> str: root = Path(projects_root).resolve() if projects_root else get_settings().projects_root.resolve() base_path = root / "book_projects" / project_name.strip().replace(" ", "-").lower() base_path.mkdir(parents=True, exist_ok=True) (base_path / "briefs").mkdir(exist_ok=True) (base_path / "reports").mkdir(exist_ok=True) (base_path / "manuscript").mkdir(exist_ok=True) agents = ["comedy"] if third_agents is None else list(third_agents) proj = ProjectConfig( name=book_title, - src/storywright_mcp/session.py:54-57 (helper)Helper function save_project_and_continuity() that persists project and continuity data after add_location modifies it.
def save_project_and_continuity() -> None: proj, cont = require_project() proj.save() cont.save(proj.base_path)