Skip to main content
Glama
vandewilly

MCP Dice Roller

by vandewilly

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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,
        }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vandewilly/mcp-dice-roller'

If you have feedback or need assistance with the MCP directory API, please join our Discord server