Skip to main content
Glama
cr7258

Elasticsearch MCP Server

create_index

Create a new Elasticsearch index with custom mappings and settings to organize and store data for search and analysis.

Instructions

        Create a new index.
        
        Args:
            index: Name of the index
            body: Optional index configuration including mappings and settings
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYes
bodyNo

Implementation Reference

  • The MCP tool handler for 'create_index', decorated with @mcp.tool(). It creates a new index by calling the search client's create_index method.
    @mcp.tool()
    def create_index(index: str, body: Optional[Dict] = None) -> Dict:
        """
        Create a new index.
        
        Args:
            index: Name of the index
            body: Optional index configuration including mappings and settings
        """
        return self.search_client.create_index(index=index, body=body)
  • src/server.py:41-53 (registration)
    Top-level registration where IndexTools (containing create_index) is included in tool_classes and registered via ToolsRegister.
    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)
  • Helper method in IndexClient that implements the low-level index creation delegated by the MCP tool handler.
    def create_index(self, index: str, body: Optional[Dict] = None) -> Dict:
        """Creates an index with optional settings and mappings."""
        return self.client.indices.create(index=index, body=body)
  • IndexTools.register_tools method where the @mcp.tool() decorators register the create_index tool (and others) with the MCP instance.
    def register_tools(self, mcp: FastMCP):
        @mcp.tool()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Create a new index' implies a write/mutation operation, it doesn't disclose important behavioral traits like: whether this requires specific permissions, whether it's idempotent, what happens on conflict, rate limits, or what the response looks like. The description is minimal and lacks crucial operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with a clear purpose statement followed by parameter documentation. The Args section is well-structured. However, the description could be more front-loaded with critical information about the tool's behavior and usage context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 2 parameters, 0% schema description coverage, no annotations, and no output schema, the description is inadequate. It doesn't explain what an 'index' is in this context, what system this operates on, what happens after creation, or provide any error handling information. The description leaves too many critical questions unanswered.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It provides basic parameter names and minimal semantics ('Name of the index', 'Optional index configuration including mappings and settings'), which adds some value beyond the bare schema. However, it doesn't explain format requirements, constraints, or provide examples for the 'body' parameter configuration.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'Create a new index' which is a clear verb+resource combination, but it's quite generic and doesn't distinguish this from sibling tools like 'create_data_stream' or 'index_document'. It doesn't specify what kind of index this creates or what system it operates in.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like 'create_data_stream' or 'index_document'. The description provides no context about prerequisites, when this operation is appropriate, or what happens if an index already exists with the same name.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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