Computes the mathematical sum of any list of numbers via GET /v1/math/sum. Pass numbers as query parameters or JSON array — returns precise totals for integers, floats, or mixed datasets. Perfect for AI agents in Cursor or Claude Code that need accurate arithmetic instead of potentially incorrect LLM calculations.
curl "https://tinyfn.io/v1/math/sum" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/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/math/sum',
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"
}
}
}
}
Use query parameters like /v1/math/sum?numbers=1,2,3,4 or send a JSON array in the request body. Both methods return the same accurate result.
LLMs often make arithmetic errors on long number sequences or floating-point precision. This tool guarantees mathematically correct sums every time.
The endpoint handles thousands of numbers efficiently. Practical limits depend on URL length for query params or JSON payload size for POST requests.
Yes, it correctly processes integers, floats, negative values, and mixed number types. Returns precise decimal results when needed.
Returns JSON with the calculated sum value. For example: {"sum": 15} for adding 1+2+3+4+5.