Sorts numerical arrays by rank from largest to smallest or vice versa via GET /v1/math/rank. Perfect for MCP-enabled editors like Cursor when processing datasets, leaderboards, or statistical analysis. Returns ranked positions with original values preserved. Handles integers, decimals, and negative numbers with deterministic ordering for consistent AI agent workflows.
curl "https://tinyfn.io/v1/math/rank" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/rank', {
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/rank',
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 the ascending parameter in your request. The default behavior ranks from largest to smallest (descending=true).
Duplicate values receive the same rank, with subsequent ranks adjusted accordingly (e.g., two items tied for 2nd place means the next item gets 4th place).
Yes, the tool handles all numeric types including decimals, negative numbers, and scientific notation with proper mathematical ordering.
Cursor can call the rank function directly on arrays in your code, making it instant to sort performance metrics, scores, or any numerical data during development.
The response includes both the ranked positions and original values, so you can map rankings back to your source data or identifiers.
Get your free API key and start using Rank Numbers in seconds.
Get Free API Key