request_revision
Send a chapter back to the writer with revision notes to request changes within the multi-agent book-writing pipeline.
Instructions
Send chapter back to writer with notes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chapter_num | Yes | ||
| notes | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/storywright_mcp/workflow.py:480-494 (handler)Core handler for request_revision tool. Loads project, finds chapter, records revision note in continuity and persistence queue, resets chapter status to DRAFT, clears third_pass_completed and editor_verdict, then saves project.
def request_revision(chapter_num: int, notes: str) -> str: proj, cont = require_project() chapter = proj.get_chapter(chapter_num) if not chapter: return "Chapter not found." cont.add_revision_note(chapter_num, "editor", notes) append_revision(proj.base_path, chapter_num, notes, agent="editor") chapter.status = ChapterStatus.DRAFT chapter.third_pass_completed = [] chapter.editor_verdict = None save_project_and_continuity() return ( f"Revision requested — status DRAFT. Notes recorded in continuity and " f"`briefs/revision_queue.json`.\n\nNext: run_writer_agent({chapter_num})" ) - src/storywright_mcp/app.py:217-223 (registration)FastMCP tool registration of 'request_revision' — decorator @mcp.tool() on async function that delegates to workflow.request_revision.
@mcp.tool() async def request_revision(chapter_num: int, notes: str) -> str: """Send chapter back to writer with notes.""" try: return workflow.request_revision(chapter_num, notes) except ValueError as e: return str(e) - Helper that appends a revision entry (chapter, notes, agent, timestamp) to the revision_queue.json file on disk.
def append_revision(base_path: Path, chapter_num: int, notes: str, agent: str = "editor") -> None: entries = load_queue(base_path) entries.append( { "chapter": chapter_num, "notes": notes, "agent": agent, "timestamp": datetime.now().isoformat(timespec="seconds"), } ) save_queue(base_path, entries) - RevisionNote dataclass: chapter, agent, notes, timestamp — schema for continuity log entries.
class RevisionNote: chapter: int agent: str notes: str timestamp: str = field(default_factory=lambda: datetime.now().isoformat()) - ContinuityLog.add_revision_note — appends a RevisionNote to the in-memory continuity log.
def add_revision_note(self, chapter: int, agent: str, notes: str) -> None: self.revision_notes.append(RevisionNote(chapter=chapter, agent=agent, notes=notes))