Statistics Utilities

Calculate Percentile

Calculates specific percentiles from numerical datasets with precise statistical accuracy. Use via MCP in AI coding tools like Cursor or Windsurf, or call GET /v1/stats/percentile directly. Perfect for data analysis tasks where you need the 95th percentile response time, median salary, or any percentile between 0-100. Returns exact values using standard statistical methods.

API Endpoint

GET /v1/stats/percentile

Code Examples

curl "https://tinyfn.io/v1/stats/percentile" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/stats/percentile', {
  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/percentile',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

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"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I calculate the 90th percentile of my dataset?

Pass your numerical array and percentile value (0-100) to the endpoint. For the 90th percentile of [1,2,3,4,5], you'd get 4.6 using linear interpolation.

What's the difference between percentile and quartile calculations?

Percentiles divide data into 100 parts (any value 0-100), while quartiles are specific percentiles: Q1=25th, Q2=50th (median), Q3=75th percentile.

Can MCP agents use this for automated performance monitoring?

Yes, AI agents in Cursor or Cline can call this tool to analyze response times, calculate SLA thresholds, or monitor system performance percentiles automatically.

Does this handle edge cases like duplicate values or small datasets?

Yes, it properly handles duplicates, single-value arrays, and uses standard interpolation methods for datasets with fewer elements than the percentile rank.

What percentile calculation method does this use?

Uses linear interpolation (R-6/Excel method) which provides consistent results across statistical tools and handles fractional ranks smoothly.

Try Calculate Percentile Now

Get your free API key and start using Calculate Percentile in seconds.

Get Free API Key