Calculates the statistical range (maximum minus minimum value) from a dataset. Use via MCP in Cursor or Windsurf, or call GET /v1/stats/range directly. Pass an array of numbers like [1, 5, 3, 9, 2] and get back 8 (9-1). Returns precise numerical results without AI hallucination.
curl "https://tinyfn.io/v1/stats/range" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/stats/range', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/stats/range',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's statistics tools:
{
"mcpServers": {
"tinyfn-stats": {
"url": "https://tinyfn.io/mcp/stats",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Pass your dataset as an array parameter to the calculate_range MCP function. It returns the difference between max and min values as a number.
Duplicates don't affect the range calculation. [1, 3, 3, 7] still returns 6 (7-1) since range only considers the extreme values.
Single-element arrays return 0 range. Empty arrays typically return an error since range is undefined without data points.
Range shows the spread between extremes (max-min), while standard deviation measures how values cluster around the mean. Range is simpler but less robust against outliers.
Yes, it handles negative numbers correctly. For [-5, -1, 3], the range is 8 (3 - (-5)).
Get your free API key and start using Calculate Range in seconds.
Get Free API Key