pick_random
Select a random item from a comma-separated list of options for decision-making, game mechanics, or random selection tasks.
Instructions
Pick a random option from a comma-separated list.
Args: options: Comma-separated list of options (e.g., "pizza, burger, sushi")
Returns: The randomly selected option
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| options | Yes |
Implementation Reference
- src/mcp_dice_roller/server.py:187-211 (handler)The pick_random tool handler, which takes a comma-separated string of options and returns a random selection, with basic validation for input length.
def pick_random(options: str) -> dict: """ Pick a random option from a comma-separated list. Args: options: Comma-separated list of options (e.g., "pizza, burger, sushi") Returns: The randomly selected option """ option_list = [opt.strip() for opt in options.split(",") if opt.strip()] if len(option_list) < 2: return {"error": "Please provide at least 2 comma-separated options"} if len(option_list) > 100: return {"error": "Maximum 100 options allowed"} choice = random.choice(option_list) return { "options": option_list, "selected": choice, "total_options": len(option_list), }