Statistics MCP Tools for AI Agents

"What's the standard deviation of [4, 8, 15, 16, 23, 42]?" Your agent says 12.1. The actual population std dev is 12.74, and the sample std dev is 13.97. Which one was asked for? LLMs don't clarify or compute correctly. These tools do both.

All Statistics Tools (16)

Your agent gets access to 16 statistics tools via the /mcp/stats/ endpoint. Here's the complete list:

ToolDescription
stats/meanCalculate Mean
stats/medianCalculate Median
stats/modeCalculate Mode
stats/varianceCalculate Variance
stats/stddevCalculate Stddev
stats/percentileCalculate Percentile
stats/quartilesCalculate Quartiles
stats/rangeCalculate Range
stats/sumCalculate Sum
stats/productCalculate Product
stats/geometric-meanGeometric Mean
stats/harmonic-meanHarmonic Mean
stats/z-scoreCalculate Zscore
stats/correlationCalculate Correlation
stats/covarianceCalculate Covariance
stats/describeDescribe Data

Agent Scenarios

Here's how real agents use these tools:

1. Business analytics agent

A reporting agent calculates mean, median, and percentiles for monthly revenue data.

Tool Call: stats/mean
{ "numbers": [45000, 52000, 48000, 61000, 55000] }

2. Quality control agent

A manufacturing agent calculates standard deviation to detect production anomalies.

Tool Call: stats/standard-deviation
{ "numbers": [10.1, 10.3, 9.9, 10.0, 10.2] }

3. Grading agent

An education agent calculates percentile ranks for student test scores.

Tool Call: stats/percentile
{ "numbers": [65, 72, 78, 81, 85, 90, 92, 95], "percentile": 75 }

MCP Setup

Add statistics tools to your agent in under 2 minutes. Choose your client:

Claude Desktop / Claude Code

Add this to your MCP config:

{
  "mcpServers": {
    "tinyfn-stats": {
      "url": "https://api.tinyfn.io/mcp/stats/",
      "headers": {
        "X-API-Key": "your-api-key"
      }
    }
  }
}

Cursor

Go to Settings > MCP and add a new server:

  • Type: SSE
  • URL: https://api.tinyfn.io/mcp/stats/sse
  • Headers: X-API-Key: your-api-key

Tip: Use the category-specific endpoint (/mcp/stats/) for the best experience. The all-in-one endpoint (/mcp/all/) works too but has 500+ tools which some clients handle less efficiently.

When to Use These Tools

Use statistics MCP tools when your agent needs to:

  • Guarantee correctness — when wrong answers have real consequences
  • Process user data — when you're operating on actual user input, not hypothetical examples
  • Maintain consistency — when the same input must always produce the same output

You don't need these tools for casual conversation or rough estimates. Use them when precision matters.

Ready to add statistics tools to your agent?

Get Free API Key 100 requests/month free. No credit card required.

Frequently Asked Questions

Why do LLMs struggle with statistics?

Statistical calculations require precise multi-step math. LLMs attempt to compute these mentally and frequently make arithmetic errors, especially with variance and standard deviation calculations.

Does TinyFn provide both sample and population statistics?

Yes. Where applicable, TinyFn returns both population and sample variants (e.g., population standard deviation and sample standard deviation).

What statistical measures does TinyFn support?

TinyFn provides mean, median, mode, variance, standard deviation, percentiles, min, max, range, sum, and other descriptive statistics.

Ready to try TinyFn?

Get your free API key and start building in minutes.

Get Free API Key