Categories

Take While

Take items while a predicate matches using lodash _.takeWhile

Take items from the start of an array while a predicate stays true. **Highlights:** - Uses lodash `_.takeWhile` - Supports numeric and string predicates - Returns the matching prefix as JSON **Example:** - Array: `[1, 2, 3, 1]` - Predicate: `less-than` - Compare: `3` - Result: `[1, 2]`

Enter a JSON array

Select the condition for taking items

Value to compare against (required for most predicates)

API Documentation

Request Endpoint

POST /en/api/tools/take-while

Request Parameters

Parameter Name Type Required Description
array textarea Yes Enter a JSON array
predicateType select Yes Select the condition for taking items
compareValue text No Value to compare against (required for most predicates)

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-take-while": {
      "name": "take-while",
      "description": "Take items while a predicate matches using lodash _.takeWhile",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=take-while",
      "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]