Skip to main content
Glama
cr7258

Elasticsearch MCP Server

put_alias

Create or update an alias for an Elasticsearch index to simplify index management and reference documents.

Instructions

Create or update an alias for a specific index. Args: index: Name of the index name: Name of the alias body: Alias configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYes
nameYes
bodyYes

Implementation Reference

  • MCP tool handler function for 'put_alias'. Registers the tool and implements the logic by delegating to the search client's put_alias method. The docstring provides input schema.
    @mcp.tool() def put_alias(index: str, name: str, body: Dict) -> Dict: """ Create or update an alias for a specific index. Args: index: Name of the index name: Name of the alias body: Alias configuration """ return self.search_client.put_alias(index=index, name=name, body=body)
  • The underlying client method that performs the actual Elasticsearch/OpenSearch put_alias API call.
    def put_alias(self, index: str, name: str, body: Dict) -> Dict: """Creates or updates an alias.""" return self.client.indices.put_alias(index=index, name=name, body=body)
  • src/server.py:44-53 (registration)
    Registration of AliasTools class in the main server, which leads to instantiation and calling register_tools to define and register the put_alias tool.
    tool_classes = [ IndexTools, DocumentTools, ClusterTools, AliasTools, DataStreamTools, GeneralTools, ] # Register all tools register.register_all_tools(tool_classes)
  • Instantiation of AliasTools with search_client and preparation for registration, including risk management setup.
    for tool_class in tool_classes: self.logger.info(f"Registering tools from {tool_class.__name__}") tool_instance = tool_class(self.search_client)

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