Extract portions of arrays with precise start/end indices using TinyFn's slice tool. Available via MCP in Cursor and other AI coding assistants, or REST at GET /v1/array/slice. Returns ["b", "c"] from ["a", "b", "c", "d"] with start=1, end=3. Handles negative indices and boundary cases deterministically.
curl "https://tinyfn.io/v1/array/slice" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/array/slice', {
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/slice',
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"
}
}
}
}
Send array data with start and optional end indices to GET /v1/array/slice. Start is inclusive, end is exclusive (like Python/JavaScript slice).
Yes, negative indices count from the end of the array. Index -1 refers to the last element, -2 to second-to-last, etc.
TinyFn handles boundary cases gracefully - indices beyond array length are clamped to valid ranges, preventing errors.
AI coding assistants can slice arrays for data processing, pagination logic, or extracting subsets without writing custom loop code.
TinyFn provides consistent slice behavior across different programming contexts and guaranteed deterministic results for AI agents.