Determines whether any given year is a leap year using standard Gregorian calendar rules. Access via MCP in Cursor or Windsurf for instant validation, or call GET /v1/time/is-leap-year with a year parameter. Returns a boolean result — no guesswork about divisibility by 4, 100, or 400. Essential for date calculations and calendar logic in AI agents.
curl "https://tinyfn.io/v1/time/is-leap-year" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/time/is-leap-year', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/time/is-leap-year',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's time/timezone tools:
{
"mcpServers": {
"tinyfn-time": {
"url": "https://tinyfn.io/mcp/time",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Years divisible by 4 are leap years, except years divisible by 100 (not leap), except years divisible by 400 (leap again). So 2000 was a leap year, 1900 wasn't, 2024 is.
Call the is-leap-year tool in Cursor or another MCP client with year=2028. Returns true since 2028 is divisible by 4 and not a century year.
Returns JSON with a boolean result, like {"is_leap_year": true}. Clean, deterministic output for programmatic use.
Yes, the tool handles any valid integer year. 1800 returns false (divisible by 100 but not 400), 3000 returns false for the same reason.
Eliminates off-by-one errors and edge case bugs. The century/400-year rules are tricky to implement correctly, especially in AI agent workflows.
Get your free API key and start using Is Leap Year in seconds.
Get Free API Key