Calculate the arithmetic mean of any list of numbers via GET /v1/math/average or MCP integration. Pass numbers as comma-separated values or array — returns precise decimal result. Essential for data analysis in Claude Code and Cursor workflows where statistical calculations need deterministic accuracy over AI approximations.
curl "https://tinyfn.io/v1/math/average" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/average', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/math/average',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's math tools:
{
"mcpServers": {
"tinyfn-math": {
"url": "https://tinyfn.io/mcp/math",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Send GET request to /v1/math/average with numbers parameter as comma-separated values (e.g., ?numbers=10,20,30) or use the MCP tool in supported editors.
Empty arrays return an error since mathematical average is undefined for zero elements. Always validate your dataset has at least one number.
Yes, returns exact decimal results without floating-point errors. For example, average of 0.1, 0.2, 0.3 returns 0.2 precisely, not 0.19999999.
Absolutely. Cursor, Windsurf, and Claude Code can invoke this tool directly for statistical analysis, avoiding hallucinated math in data processing scripts.
Provides consistent results across platforms and eliminates the need to import math libraries. Especially useful for quick calculations in AI agent workflows.