get_living_characters
Retrieve a list of all living characters in the story, helping authors maintain continuity and track character statuses throughout the writing pipeline.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_living_characters"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/storywright_mcp/app.py:235-240 (handler)MCP tool handler function that exposes get_living_characters as a tool via the @mcp.tool() decorator. Calls workflow.get_living_characters().
@mcp.tool() async def get_living_characters() -> str: try: return workflow.get_living_characters() except ValueError as e: return str(e) - src/storywright_mcp/workflow.py:521-532 (handler)Core implementation: loads the current project continuity, filters living_characters by CharacterStatus (ALIVE/DEAD), and returns a formatted string of living and dead characters with their items/death chapters.
def get_living_characters() -> str: _, cont = require_project() alive = [c for c in cont.living_characters if c.status == CharacterStatus.ALIVE] dead = [c for c in cont.living_characters if c.status == CharacterStatus.DEAD] out = [f"Living ({len(alive)}):\n"] for c in alive: out.append(f"- {c.name} items: {', '.join(c.items) if c.items else '—'}\n") if dead: out.append(f"\nDead ({len(dead)}):\n") for c in dead: out.append(f"- ~~{c.name}~~ ch.{c.death_chapter}\n") return "".join(out) - CharacterStatus enum used to filter ALIVE vs DEAD characters in the get_living_characters implementation.
class CharacterStatus(str, Enum): ALIVE = "alive" DEAD = "dead" - CharacterState dataclass with fields (name, status, death_chapter, death_cause, items) used to represent each character.
@dataclass class CharacterState: name: str status: CharacterStatus = CharacterStatus.ALIVE death_chapter: int | None = None death_cause: str = "" items: list[str] = field(default_factory=list) - src/storywright_mcp/app.py:235-240 (registration)The @mcp.tool() decorator on line 235 registers get_living_characters as a FastMCP tool.
@mcp.tool() async def get_living_characters() -> str: try: return workflow.get_living_characters() except ValueError as e: return str(e)