from typing import Literal

from mcp.server.fastmcp import FastMCP
from mcp.types import ToolAnnotations

server = FastMCP("Fictional library")
GUIDE_URI = "library://guide/visiting"
HOURS = {"central": "09:00–17:00", "west": "10:00–16:00"}


@server.resource(GUIDE_URI, mime_type="text/plain")
def visiting_guide() -> str:
    return "Ask at the front desk for a visitor card. Equipment bookings go to the media desk."


@server.tool(annotations=ToolAnnotations(readOnlyHint=True, openWorldHint=False))
def lookup_hours(branch: Literal["central", "west"]) -> dict[str, str]:
    """Return the opening hours for one fictional library branch."""
    return {"branch": branch, "hours": HOURS[branch]}


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