roll_percentile
Generate random numbers from 1 to 100 for tabletop gaming, probability testing, or decision-making scenarios using percentile dice rolls.
Instructions
Roll percentile dice (d100).
Returns: A random number from 1 to 100
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_dice_roller/server.py:214-232 (handler)The `roll_percentile` tool implementation using `@mcp.tool()` decorator in `server.py`. It simulates rolling two 10-sided dice (tens and ones) and returns the result, handling the 0 case as 100.
@mcp.tool() def roll_percentile() -> dict: """ Roll percentile dice (d100). Returns: A random number from 1 to 100 """ tens = random.randint(0, 9) * 10 ones = random.randint(0, 9) result = tens + ones if result == 0: result = 100 return { "tens_die": tens // 10 if tens > 0 else 10, "ones_die": ones if ones > 0 or tens > 0 else 10, "result": result, }