Skip to main content
Glama
cr7258

Elasticsearch MCP Server

delete_document

Remove a specific document from an Elasticsearch index by providing the index name and document ID. This tool simplifies document deletion in Elasticsearch clusters.

Instructions

Delete a document by ID. Args: index: Name of the index id: Document ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
indexYes

Implementation Reference

  • The primary MCP tool handler for 'delete_document'. This function is defined and registered using @mcp.tool() within DocumentTools.register_tools. It delegates the deletion to the search client's delete_document method.
    @mcp.tool() def delete_document(index: str, id: str) -> Dict: """ Delete a document by ID. Args: index: Name of the index id: Document ID """ return self.search_client.delete_document(index=index, id=id)
  • Supporting helper method in DocumentClient (search_client) that performs the actual document deletion by calling the underlying client.delete() method.
    def delete_document(self, index: str, id: str) -> Dict: """Removes a document from the index.""" return self.client.delete(index=index, id=id)
  • src/server.py:41-53 (registration)
    The DocumentTools class (containing delete_document) is registered via inclusion in tool_classes list passed to ToolsRegister.register_all_tools, which instantiates it and calls its register_tools method.
    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)
  • delete_document is flagged as a high-risk operation for DocumentTools, subject to runtime filtering via RiskManager.
    "DocumentTools": { "index_document", "delete_document", "delete_by_query", },

Other Tools

Related Tools

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