name = "text_formatter"
description = "Formats text by converting it to uppercase, lowercase, or title case. Useful for quick text manipulation."
parameters = {
    "type": "object",
    "properties": {
        "text": {"type": "string", "description": "The input text to format"},
        "mode": {"type": "string", "enum": ["upper", "lower", "title"], "description": "The formatting mode to apply"},
    },
    "required": ["text", "mode"],
}

async def execute(params: dict) -> str:
    text = params["text"]
    mode = params["mode"]
    
    if mode == "upper":
        return text.upper()
    elif mode == "lower":
        return text.lower()
    elif mode == "title":
        return text.title()
    else:
        raise ValueError("Invalid mode. Use 'upper', 'lower', or 'title'.")