Counts how often each item appears in an array, returning frequency statistics as key-value pairs. Access via MCP in Cursor or Windsurf for AI-powered data analysis, or call GET /v1/array/frequency directly. Input `["apple", "banana", "apple"]` returns `{"apple": 2, "banana": 1}`. Handles strings, numbers, and mixed data types deterministically.
curl "https://tinyfn.io/v1/array/frequency" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/array/frequency', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/array/frequency',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's array tools:
{
"mcpServers": {
"tinyfn-array": {
"url": "https://tinyfn.io/mcp/array",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Each unique value is treated as a distinct key regardless of type. Numbers and strings are separate: `[1, "1", 1]` returns `{"1": 2, "1": 1}`.
Yes, it's available in Cursor, Claude Code, and other MCP-compatible editors. Perfect for analyzing datasets, counting categorical variables, or finding duplicate patterns in AI workflows.
Returns a JSON object where keys are the unique array items and values are their occurrence counts. Empty arrays return `{}`.
Keys in the result object are always strings (JSON limitation), but the counting logic respects original types during processing.
Null values are counted as `"null"` keys. Undefined values are typically converted to `"undefined"` or filtered out depending on input parsing.
Get your free API key and start using Array Frequency in seconds.
Get Free API Key