roll_multiple
Roll dice multiple times using standard notation to generate results and statistics for tabletop gaming or probability testing.
Instructions
Roll the same dice multiple times.
Args: notation: Dice notation (e.g., '1d20+5') times: Number of times to roll (1-20)
Returns: Dictionary with all roll results and statistics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notation | No | 1d6 | |
| times | No |
Implementation Reference
- src/mcp_dice_roller/server.py:87-123 (handler)The implementation of the `roll_multiple` MCP tool, which performs a series of dice rolls based on a provided notation and calculates statistics.
@mcp.tool() def roll_multiple(notation: str = "1d6", times: int = 1) -> dict: """ Roll the same dice multiple times. Args: notation: Dice notation (e.g., '1d20+5') times: Number of times to roll (1-20) Returns: Dictionary with all roll results and statistics """ if times < 1 or times > 20: return {"error": "Times must be between 1 and 20"} results = [] totals = [] for i in range(times): roll_result = roll_dice(notation) if "error" in roll_result: return roll_result results.append(roll_result) totals.append(roll_result["total"]) return { "notation": notation, "times": times, "results": results, "totals": totals, "statistics": { "min": min(totals), "max": max(totals), "sum": sum(totals), "average": round(sum(totals) / len(totals), 2), }, }