Statistics Utilities

Calculate Sum

Sum calculation tool that adds arrays of numbers with precise floating-point arithmetic. Access via MCP in Cursor or Windsurf, or GET /v1/stats/sum REST endpoint. Pass numbers as query parameters: `/v1/stats/sum?numbers=1,2,3.5` returns `{"sum": 6.5}`. Handles large datasets and maintains precision for financial calculations.

API Endpoint

GET /v1/stats/sum

Code Examples

curl "https://tinyfn.io/v1/stats/sum" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/stats/sum', {
  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/sum',
    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 sum an array of numbers using the MCP tool?

Call the Calculate Sum tool with your number array. In Cursor or Claude Code, the MCP integration handles the computation without hallucination risks.

What's the REST API format for calculating sums?

Send GET request to `/v1/stats/sum?numbers=1,2,3.14,5` — returns JSON with sum value. Comma-separate numbers in the query parameter.

Does this handle floating-point precision issues?

Yes, uses proper decimal arithmetic to avoid JavaScript's 0.1 + 0.2 = 0.30000000000000004 problem. Safe for financial calculations.

Can I sum negative numbers and mixed values?

Absolutely. Handles positive, negative, integers, and decimals: `-5.5, 10, -2.3` works correctly.

What's the maximum array size for sum calculations?

No practical limit for typical use cases. Designed to handle large datasets efficiently without memory issues.

Try Calculate Sum Now

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

Get Free API Key