Sum Digits adds up all individual digits in a number, returning the total as an integer. Access via MCP in Cursor or Windsurf, or call GET /v1/number/sum-digits with your number. For example, 12345 becomes 15 (1+2+3+4+5). Handles negative numbers by ignoring the sign and processing absolute values.
curl "https://tinyfn.io/v1/number/sum-digits" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/number/sum-digits', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/number/sum-digits',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's number tools:
{
"mcpServers": {
"tinyfn-number": {
"url": "https://tinyfn.io/mcp/number",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
The function ignores the negative sign and sums digits of the absolute value. So -789 returns 24 (7+8+9).
Single digits return themselves unchanged. For example, 7 returns 7, and 0 returns 0.
Yes, repeatedly call sum digits until you get a single digit. Many AI agents use this pattern for numerology or checksum validation.
Returns a simple integer representing the sum. No decimal places or additional formatting.
Only the integer portion is processed. Decimal points and fractional parts are ignored in the digit summation.