list_indices
Retrieve all indices from an Elasticsearch cluster to view available data collections for querying and management.
Instructions
List all indices in the Elasticsearch cluster.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_indices"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tools/elastic_tool.py:38-47 (handler)The handler function for the 'list_indices' tool. It lists all non-hidden indices in the Elasticsearch cluster by fetching aliases and filtering out those starting with '.'.
@mcp.tool() def list_indices() -> list: """List all indices in the Elasticsearch cluster.""" try: indices = es.indices.get_alias() filtered = [name for name in indices.keys() if not name.startswith('.')] return filtered except Exception as e: logger.error(f"Error listing indices: {e}") return []