Skip to main content
Glama
cr7258

Elasticsearch MCP Server

delete_index

Remove an Elasticsearch index to free storage space and manage cluster resources by specifying the index name.

Instructions

        Delete an index.
        
        Args:
            index: Name of the index
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYes

Implementation Reference

  • The MCP tool handler function for 'delete_index'. It is decorated with @mcp.tool() and delegates the deletion to the underlying search client.
    @mcp.tool()
    def delete_index(index: str) -> Dict:
        """
        Delete an index.
        
        Args:
            index: Name of the index
        """
        return self.search_client.delete_index(index=index)
  • The underlying client method implementation that performs the actual index deletion using the Elasticsearch/OpenSearch client.
    def delete_index(self, index: str) -> Dict:
        """Delete an index."""
        return self.client.indices.delete(index=index)
  • src/server.py:41-53 (registration)
    Registration of IndexTools (containing delete_index) via ToolsRegister.register_all_tools during server initialization.
    register = ToolsRegister(self.logger, self.search_client, self.mcp)
    
    # Define all tool classes to register
    tool_classes = [
        IndexTools,
        DocumentTools,
        ClusterTools,
        AliasTools,
        DataStreamTools,
        GeneralTools,
    ]        
    # Register all tools
    register.register_all_tools(tool_classes)
  • Configuration marking 'delete_index' as a high-risk operation for IndexTools, which can conditionally disable its registration.
    HIGH_RISK_OPERATIONS = {
        "IndexTools": {
            "create_index",
            "delete_index",
        },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cr7258/elasticsearch-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server