Skip to main content
Glama
awesimon

Elasticsearch MCP Server

delete_index_template

Delete an existing Elasticsearch index template by specifying its name. This tool helps manage index templates, removing those that are no longer needed.

Instructions

Delete an Elasticsearch index template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the template to delete

Implementation Reference

  • The actual handler function that executes the delete_index_template tool logic. It calls esClient.indices.deleteIndexTemplate with the provided name and returns a success/error message.
    export async function deleteIndexTemplate(
      esClient: Client,
      name: string
    ) {
      try {
        const response = await esClient.indices.deleteIndexTemplate({
          name
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: response.acknowledged 
                ? `Index template "${name}" deleted successfully.`
                : `Index template delete request sent, but not acknowledged. Check cluster status.`
            }
          ]
        };
      } catch (error) {
        console.error(`Delete index template failed: ${error instanceof Error ? error.message : String(error)}`);
        return {
          content: [
            {
              type: "text" as const,
              text: `Error: ${error instanceof Error ? error.message : String(error)}`
            }
          ]
        };
  • src/server.ts:276-290 (registration)
    Registers the 'delete_index_template' tool with the MCP server, defining the schema (name: zod string) and wiring it to the deleteIndexTemplate handler.
    // Delete an index template
    server.tool(
      "delete_index_template",
      "Delete an Elasticsearch index template",
      {
        name: z
          .string()
          .trim()
          .min(1, "Template name is required")
          .describe("Name of the template to delete")
      },
      async ({ name }) => {
        return await deleteIndexTemplate(esClient, name);
      }
    );
  • Import of the deleteIndexTemplate function from the tools module to be used in server registration.
    import { createIndexTemplate, getIndexTemplate, deleteIndexTemplate } from "./tools/createIndexTemplate.js";
    
    export { 
      listIndices, 
      getMappings, 
      search, 
      getClusterHealth, 
      createIndex, 
      createMapping, 
      bulk, 
      reindex, 
      createIndexTemplate,
      getIndexTemplate,
      deleteIndexTemplate
    }; 
  • Re-export of deleteIndexTemplate alongside other tool functions for external use.
      createIndexTemplate,
      getIndexTemplate,
      deleteIndexTemplate
    }; 
Behavior1/5

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

No annotations exist, so the description bears full responsibility for behavioral disclosure. It only says 'Delete an Elasticsearch index template' without mentioning irreversibility, permissions, or effects on existing indices.

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

Conciseness3/5

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

The description is a single sentence with no wasted words, but it is too brief to be fully informative. Conciseness is achieved at the expense of clarity.

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 delete operation with no output schema and one parameter, the minimal description fails to convey important context such as irreversibility or required permissions. It feels incomplete for an agent.

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 coverage is 100% and the schema already describes the 'name' parameter. The description adds no additional meaning beyond the schema.

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

Purpose5/5

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

The description clearly states the verb 'Delete' and the resource 'Elasticsearch index template', uniquely distinguishing it from sibling tools like create_index_template and get_index_template.

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 is provided on when to use this tool, prerequisites, or alternatives. The description simply states the action without any contextual cues.

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/awesimon/elasticsearch-mcp'

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