Development
Randomly select specified number of elements from an array with support for different sampling methods
Call this tool from your code in three languages.
curl -X POST 'https://api.elysiatools.com/en/api/tools/array-random-sampler' \
-H 'Content-Type: application/json' \
-d '{"arrayInput":"Enter array elements separated by delimiter...\napple, banana, orange, grape, mango, peach, kiwi, pineapple","delimiter":"comma","customDelimiter":"Enter custom delimiter","sampleSize":3,"samplingMethod":"simple","seed":0,"allowDuplicates":false,"preserveOrder":false,"outputFormat":"table"}'Send a POST request with your inputs as JSON. File parameters require a separate upload first.
POST https://api.elysiatools.com/en/api/tools/array-random-sampler| Name | Type | Required | Description |
|---|---|---|---|
| arrayInput | textarea | Yes | — |
| delimiter | select | Yes | — |
| customDelimiter | text | No | — |
| sampleSize | number | No | — |
| samplingMethod | select | Yes | — |
| seed |
Add this tool to your Model Context Protocol server so AI agents can list and call it.
Add this block to your MCP client configuration:
{
"mcpServers": {
"elysiatools-array-random-sampler": {
"name": "array-random-sampler",
"description": "Randomly select specified number of elements from an array with support for different sampling methods",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=array-random-sampler",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}After connecting to the SSE endpoint, list the exposed tools:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Invoke the tool by its id, passing arguments built from its parameters:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "array-random-sampler",
"arguments": {
"arrayInput": "Enter array elements separated by delimiter...\napple, banana, orange, grape, mango, peach, kiwi, pineapple",
"delimiter": "comma",
"customDelimiter": "Enter custom delimiter",
"sampleSize": 3,
"samplingMethod": "simple",
"seed": 0,
"allowDuplicates": false,
"preserveOrder": false,
"outputFormat": "table"
}
}
}| number |
| No |
| — |
| allowDuplicates | checkbox | No | — |
| preserveOrder | checkbox | No | — |
| outputFormat | select | Yes | — |
Text result
{
"result": "Processed text content",
"error": "Error message (optional)",
"message": "Notification message (optional)",
"metadata": {
"key": "value"
}
}Questions or issues? Contact [email protected]