from fastmcp import FastMCP

CHAPTERS = {
    "Python and Roots": 7,
    "Python and Branches": 8,
}

mcp = FastMCP("Book chapters")

@mcp.tool
def chapter_lessons(title: str) -> str:
    """Return the lesson count for a published chapter title."""
    if title not in CHAPTERS:
        return f"Not found: no chapter titled {title!r} in this table."
    return f"{title}: {CHAPTERS[title]} lessons"

if __name__ == "__main__":
    mcp.run(transport="stdio")
