Count Items tallies occurrences of each unique element in a dataset. Use it via MCP in Cursor or Windsurf, or call GET /v1/misc/count with your data. Pass an array like ["apple", "banana", "apple"] and get back {"apple": 2, "banana": 1}. Handles strings, numbers, and mixed data types reliably.
curl "https://tinyfn.io/v1/misc/count" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/misc/count', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/misc/count',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's miscellaneous tools:
{
"mcpServers": {
"tinyfn-misc": {
"url": "https://tinyfn.io/mcp/misc",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Call the count_items tool with your array as input. It returns a frequency map showing how many times each unique item appears.
It processes strings, numbers, booleans, and mixed arrays. Each unique value gets counted separately, so '1' and 1 are treated as different items.
No, it counts top-level array elements only. Nested structures are treated as single items and compared by reference.
Empty strings, null, and undefined values are counted as distinct items. Each gets its own count in the returned frequency map.
The tool handles arrays efficiently but very large datasets (100k+ items) may hit API timeout limits. Consider chunking massive data.