Skip to main content
Glama

update_plan

Patch the book bible JSON file and sync characters, deaths, or gags into the project to maintain continuity.

Instructions

Patch book_bible.json; may sync characters/deaths/gags into project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sectionNoall
changesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core handler for update_plan tool: loads the book bible, applies section changes via apply_bible_section, saves, and optionally syncs characters/deaths/gags into the project via finalize_bible.
    async def run_update_plan(section: str = "all", changes: dict | None = None) -> str:
        proj, _cont = require_project()
        bible = BookBible.load(proj.base_path)
    
        if changes is None:
            return (
                f"# Update bible — section `{section}`\n\n"
                f"Call update_plan(section=\"{section}\", changes={{...}}) with partial bible fields.\n"
                f"Use get_book_bible() to review.\n"
            )
    
        apply_bible_section(bible, section, changes)
        bible.save(proj.base_path)
    
        if section in ("all", "characters", "deaths", "gags"):
            finalize_bible(bible, proj, _cont)
        else:
            save_project_and_continuity()
    
        return f"Bible updated (section={section}). Sync ran for characters/deaths/gags sections."
  • Tool registration via @mcp.tool() decorator on FastMCP instance. Delegates to run_update_plan.
    @mcp.tool()
    async def update_plan(section: str = "all", changes: dict | None = None) -> str:
        """Patch book_bible.json; may sync characters/deaths/gags into project."""
        try:
            return await run_update_plan(section=section, changes=changes)
        except ValueError as e:
            return str(e)
  • Helper that applies partial bible field changes per section (all, identity, world, characters, structure, deaths, gags, tone). Deserializes nested models as needed.
    def apply_bible_section(bible: BookBible, section: str, changes: dict) -> None:
        if section == "all":
            for key, value in changes.items():
                if hasattr(bible, key):
                    setattr(bible, key, value)
            return
    
        if section == "identity":
            if "title" in changes:
                bible.title = changes["title"]
            if "genre" in changes:
                bible.genre = changes["genre"]
            if "logline" in changes:
                bible.logline = changes["logline"]
            if "themes" in changes:
                from .models.bible import Theme
    
                bible.themes = [
                    Theme(name=t["name"], description=t.get("description", "")) if isinstance(t, dict) else t
                    for t in changes["themes"]
                ]
            if "comparable_books" in changes:
                bible.comparable_books = changes["comparable_books"]
        elif section == "world":
            if "world_name" in changes:
                bible.world_name = changes["world_name"]
            if "world_description" in changes:
                bible.world_description = changes["world_description"]
            if "world_rules" in changes:
                bible.world_rules = changes["world_rules"]
            if "magic_systems" in changes:
                from .models.bible import MagicSystem
    
                bible.magic_systems = [
                    MagicSystem(**m) if isinstance(m, dict) else m for m in changes["magic_systems"]
                ]
            if "locations" in changes:
                from .models.bible import Location
    
                bible.locations = [Location(**loc) if isinstance(loc, dict) else loc for loc in changes["locations"]]
        elif section == "characters":
            from .models.bible import CharacterProfile
    
            if "characters" in changes:
                bible.characters = [
                    CharacterProfile(**c) if isinstance(c, dict) else c for c in changes["characters"]
                ]
        elif section == "structure":
            if "act_structure" in changes:
                bible.act_structure = changes["act_structure"]
            if "chapter_count" in changes:
                bible.chapter_count = changes["chapter_count"]
            if "plot_beats" in changes:
                from .models.bible import PlotBeat
    
                bible.plot_beats = [
                    PlotBeat(**b) if isinstance(b, dict) else b for b in changes["plot_beats"]
                ]
        elif section == "deaths":
            from .models.bible import DeathPlan
    
            if "deaths" in changes:
                bible.deaths = [DeathPlan(**d) if isinstance(d, dict) else d for d in changes["deaths"]]
        elif section == "gags":
            from .models.bible import RunningGagPlan
    
            if "running_gags" in changes:
                bible.running_gags = [
                    RunningGagPlan(**g) if isinstance(g, dict) else g for g in changes["running_gags"]
                ]
        elif section == "tone":
            if "tone_notes" in changes:
                bible.tone_notes = changes["tone_notes"]
            if "comparable_books" in changes:
                bible.comparable_books = changes["comparable_books"]
  • Helper that syncs bible characters, deaths, and gags into the project and continuity models, then saves.
    def finalize_bible(bible: BookBible, project, continuity) -> None:
        if not project.name or project.name == "Untitled":
            project.name = bible.title or project.name
        if bible.genre and not project.genre:
            project.genre = bible.genre
    
        for char_profile in bible.characters:
            if not any(c.name == char_profile.name for c in project.characters):
                project.characters.append(
                    Character(
                        name=char_profile.name,
                        role=char_profile.role,
                        description=char_profile.backstory,
                        voice_notes=char_profile.voice_notes,
                        comedy_hook=char_profile.comedy_hook,
                    )
                )
                continuity.living_characters.append(
                    CharacterState(name=char_profile.name, status=CharacterStatus.ALIVE)
                )
    
        for death_plan in bible.deaths:
            if not any(d.character == death_plan.character for d in project.death_schedule):
                project.death_schedule.append(
                    DeathEntry(
                        character=death_plan.character,
                        chapter=death_plan.chapter,
                        circumstances=death_plan.circumstances,
                        death_style=death_plan.death_style,
                    )
                )
    
        for gag_plan in bible.running_gags:
            if not any(g.name == gag_plan.name for g in project.running_gags):
                project.running_gags.append(
                    RunningGag(
                        name=gag_plan.name,
                        owner=gag_plan.owner,
                        setup_chapter=gag_plan.setup_chapter,
                        description=gag_plan.description,
                        escalation_pattern=gag_plan.escalation_pattern,
                    )
                )
    
        if not project.chapters:
            for i in range(1, bible.chapter_count + 1):
                project.chapters.append(
                    Chapter(num=i, title=f"Chapter {i}", target_words=5000, status=ChapterStatus.NOT_STARTED)
                )
    
        project.save()
        continuity.save(project.base_path)
  • Type signature and docstring define the tool's input schema: section (str, default 'all') and changes (dict | None).
    async def update_plan(section: str = "all", changes: dict | None = None) -> str:
        """Patch book_bible.json; may sync characters/deaths/gags into project."""
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided; description only vaguely mentions 'may sync' without specifying side effects, permissions, or behavior beyond patching.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence is concise but lacks necessary details; not overly verbose but incomplete.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given low schema coverage and no annotations, description fails to provide enough context for a tool with multiple parameters and complex sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, and description does not explain what 'section' or 'changes' mean, leaving parameters meaningless.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states it patches book_bible.json and may sync characters/deaths/gags, distinguishing it from sibling tools that add individual entities.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like add_character or plan_book; lacks context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BurgersJackson/storywright-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server