add_established_fact
Add an established fact to a story chapter to preserve continuity across the multi-agent writing pipeline. Provide the fact, chapter number, and optional source.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fact | Yes | ||
| chapter | Yes | ||
| source | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/storywright_mcp/app.py:291-296 (handler)FastMCP tool handler that delegates to workflow.add_established_fact. Catches ValueError and returns the error message.
@mcp.tool() async def add_established_fact(fact: str, chapter: int, source: str = "") -> str: try: return workflow.add_established_fact(fact, chapter, source) except ValueError as e: return str(e) - src/storywright_mcp/workflow.py:580-584 (handler)Core business logic: loads the continuity, appends an EstablishedFact, saves, and returns confirmation.
def add_established_fact(fact: str, chapter: int, source: str = "") -> str: _, cont = require_project() cont.established_facts.append(EstablishedFact(fact=fact, chapter=chapter, source=source)) save_project_and_continuity() return "Fact recorded." - Data class defining the EstablishedFact schema with fields: fact (str), chapter (int), source (str, default '').
@dataclass class EstablishedFact: fact: str chapter: int source: str = "" - src/storywright_mcp/app.py:291-292 (registration)The @mcp.tool() decorator registers add_established_fact as a named FastMCP tool.
@mcp.tool() async def add_established_fact(fact: str, chapter: int, source: str = "") -> str: