Generates truly random dice rolls for any number of dice with customizable sides. Use via MCP in Cursor or Claude Code, or call GET /v1/generate/dice directly. Returns individual roll values plus sum — perfect for D&D campaigns, probability simulations, or game development. Uses cryptographically secure randomness, not pseudorandom algorithms.
curl "https://tinyfn.io/v1/generate/dice" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/generate/dice', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/generate/dice',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's generator tools:
{
"mcpServers": {
"tinyfn-generator": {
"url": "https://tinyfn.io/mcp/generator",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Specify the number of dice and sides per die in your request. For example, roll 3d6 for three six-sided dice, or 2d20 for two twenty-sided dice.
Yes, the tool works directly in Cursor, Claude Code, Windsurf, and other MCP clients. Just ask your AI to roll dice and it will call the function automatically.
This uses cryptographically secure randomness instead of pseudorandom generators, ensuring truly unpredictable results for fair gameplay or statistical sampling.
Both — you get an array of individual roll results plus the calculated sum, useful for games that need to know specific die outcomes.
The API accepts reasonable limits to prevent abuse, typically supporting standard tabletop gaming scenarios with dozens of dice per roll.