Generate arrays populated with repeated values using `/v1/array/fill`. Specify length and fill value to create consistent datasets for testing, initialization, or placeholder content. Returns `[0, 0, 0, 0, 0]` when called with length 5 and value 0. Perfect for AI agents building mock data or initializing arrays in Cursor and other MCP-enabled editors.
curl "https://tinyfn.io/v1/array/fill" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/array/fill', {
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/fill',
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"
}
}
}
}
Call `/v1/array/fill` with length and value parameters. For example, length=3 and value='test' returns ['test', 'test', 'test'].
Supports strings, numbers, booleans, and null. Complex objects or arrays as fill values depend on the specific implementation.
Yes, AI agents in Cursor or Windsurf can call this tool to create consistent arrays for unit tests, mock datasets, or initialization.
Returns an empty array `[]`. Negative lengths typically return empty arrays or throw validation errors depending on implementation.
Similar functionality but accessible via REST API and MCP. Useful when you need deterministic array creation outside JavaScript runtime environments.