"""Local stdio tutorial for mcp==1.30.0. No external services or keys."""
from mcp.server.fastmcp import FastMCP

mcp = FastMCP("label-lab")


@mcp.tool()
def normalize_label(text: str) -> dict[str, str]:
    """Trim a label and reject empty labels or more than 80 characters."""
    label = text.strip()
    if not 1 <= len(label) <= 80:
        raise ValueError("Expected 1 to 80 characters after trimming")
    return {"label": label}


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