Head Item
Get the first element of array using lodash _.head
Retrieve the first element from an array.
## Features:
- Gets the first element of any array
- Returns undefined for empty arrays
- Handles arrays with any data type
- Simple and straightforward operation
- Uses lodash _.head for reliable access
## Examples:
- Input: [1, 2, 3] → Output: 1
- Input: ["a", "b", "c"] → Output: "a"
- Input: [{id: 1}, {id: 2}] → Output: {id: 1}
- Input: [] → Output: undefined
## Use Cases:
- **Quick Preview**: Preview the first item of a collection
- **Data Validation**: Check the first element of data
- **Array Processing**: Process the leading element separately
- **Queue Operations**: Peek at the front of a queue
API Documentation
Request Endpoint
POST /en/api/tools/head-item
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-head-item": {
"name": "head-item",
"description": "Get the first element of array using lodash _.head",
"baseUrl": "https://elysiatools.com/mcp/sse?toolId=head-item",
"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]