Index Of
Find the index of a value in array using lodash _.indexOf
Find the index position of a specific value within an array.
## Features:
- Searches for a value and returns its index
- Returns -1 if the value is not found
- Supports various data types (numbers, strings, objects)
- Optional starting position for search
- Uses lodash _.indexOf for reliable searching
## Examples:
- Array: [1, 2, 3, 2], Value: 2 → Index: 1
- Array: ["a", "b", "c"], Value: "b" → Index: 1
- Array: [1, 2, 3], Value: 4 → Index: -1 (not found)
- Array: [1, 2, 3, 2], Value: 2, FromIndex: 2 → Index: 3
## Use Cases:
- **Position Finding**: Locate where an element appears
- **Duplicate Detection**: Find multiple occurrences
- **Validation**: Check if a value exists in an array
- **Data Analysis**: Analyze element positions
API Documentation
Request Endpoint
POST /en/api/tools/index-of
Request Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| array | textarea | Yes | Enter a valid JSON array to search in |
| searchValue | text | Yes | Enter the value to find (for objects/arrays use JSON format) |
| fromIndex | number | No | Optional: Start search from this index |
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-index-of": {
"name": "index-of",
"description": "Find the index of a value in array using lodash _.indexOf",
"baseUrl": "https://elysiatools.com/mcp/sse?toolId=index-of",
"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]