Extracts the element at a specified index from any array. Use `/v1/array/nth` with your array and index parameter, supporting negative indices for reverse access. Returns the exact value at that position or null for out-of-bounds indices. Perfect for MCP-enabled editors like Cursor when processing dynamic arrays.
curl "https://tinyfn.io/v1/array/nth" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/array/nth', {
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/nth',
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"
}
}
}
}
Negative indices count backwards from the end: -1 gets the last element, -2 gets second-to-last, etc. Out-of-bounds negative indices return null.
Returns null for any out-of-bounds index, whether positive or negative. No errors thrown, making it safe for dynamic array processing.
Yes, it returns whatever type exists at that index - strings, numbers, objects, or nested arrays. The tool preserves the original data type.
Provides the same functionality but through MCP, letting AI agents access array elements without executing arbitrary code. Useful for data analysis workflows.
Yes, but any index request on an empty array returns null since no valid indices exist.