Initial Items
Get all elements except the last using lodash _.initial
Retrieve all elements of an array except the last one.
## Features:
- Returns all elements except the last
- Returns empty array for single-element or empty arrays
- Handles arrays with any data type
- Simple and intuitive operation
- Uses lodash _.initial for reliable extraction
## Examples:
- Input: [1, 2, 3] → Output: [1, 2]
- Input: ["a", "b", "c", "d"] → Output: ["a", "b", "c"]
- Input: [{id: 1}, {id: 2}, {id: 3}] → Output: [{id: 1}, {id: 2}]
- Input: [1] → Output: []
- Input: [] → Output: []
## Use Cases:
- **Data Preparation**: Prepare data excluding the final element
- **Validation**: Validate all items except the last (e.g., footer data)
- **Batch Processing**: Process all but the last item
- **Array Manipulation**: Remove trailing elements
API Documentation
Request Endpoint
POST /en/api/tools/initial-items
Request Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| array | textarea | Yes | Enter a valid JSON array |
Response Format
{
"result": "Processed text content",
"error": "Error message (optional)",
"message": "Notification message (optional)",
"metadata": {
"key": "value"
}
}
Text:
Text
AI MCP Documentation
Add this tool to your MCP server configuration:
{
"mcpServers": {
"elysiatools-initial-items": {
"name": "initial-items",
"description": "Get all elements except the last using lodash _.initial",
"baseUrl": "https://elysiatools.com/mcp/sse?toolId=initial-items",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}
You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.
If you encounter any issues, please contact us at [email protected]