Skip to main content
Glama
Octodet

octodet-elasticsearch-mcp

delete_index

Remove a specific Elasticsearch index by specifying its name, ensuring streamlined data management and storage optimization.

Instructions

Delete an Elasticsearch index

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYesName of the Elasticsearch index to delete

Implementation Reference

  • The handler function for the 'delete_index' MCP tool. It takes the index name, calls the esService.deleteIndex helper, and returns a success or error message in the expected MCP content format.
    async ({ index }) => {
      try {
        await esService.deleteIndex(index);
        return {
          content: [
            { type: "text", text: `Index '${index}' deleted successfully.` },
          ],
        };
      } catch (error) {
        console.error(
          `Failed to delete index: ${
            error instanceof Error ? error.message : String(error)
          }`
        );
        return {
          content: [
            {
              type: "text",
              text: `Error: ${
                error instanceof Error ? error.message : String(error)
              }`,
            },
          ],
        };
      }
    }
  • Zod schema defining the input parameters for the 'delete_index' tool: a required trimmed string 'index' name.
    {
      index: z
        .string()
        .trim()
        .min(1, "Index name is required")
        .describe("Name of the Elasticsearch index to delete"),
    },
  • src/index.ts:991-1027 (registration)
    Registration of the 'delete_index' tool using server.tool(), including name, description, input schema, and handler function.
    server.tool(
      "delete_index",
      "Delete an Elasticsearch index",
      {
        index: z
          .string()
          .trim()
          .min(1, "Index name is required")
          .describe("Name of the Elasticsearch index to delete"),
      },
      async ({ index }) => {
        try {
          await esService.deleteIndex(index);
          return {
            content: [
              { type: "text", text: `Index '${index}' deleted successfully.` },
            ],
          };
        } catch (error) {
          console.error(
            `Failed to delete index: ${
              error instanceof Error ? error.message : String(error)
            }`
          );
          return {
            content: [
              {
                type: "text",
                text: `Error: ${
                  error instanceof Error ? error.message : String(error)
                }`,
              },
            ],
          };
        }
      }
    );
  • Supporting helper method in the ElasticsearchService class that deletes the specified index using the Elasticsearch client.
    async deleteIndex(index: string): Promise<any> {
      return await this.client.indices.delete({
        index,
      });
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'Delete' implies a destructive operation, the description doesn't specify whether this action is irreversible, requires specific permissions, affects data permanently, or has rate limits. For a destructive tool with zero annotation coverage, this is a significant gap in safety information.

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

Conciseness5/5

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

The description is a single, efficient sentence that states exactly what the tool does with zero wasted words. It's appropriately sized for a simple tool with one parameter and gets straight to the point without unnecessary elaboration.

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 destructive operation with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what happens after deletion (e.g., confirmation, error handling), doesn't warn about irreversible data loss, and provides no context about when this operation is appropriate versus document-level deletion alternatives.

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 100%, with the single parameter 'index' clearly documented in the schema as 'Name of the Elasticsearch index to delete'. The description doesn't add any additional semantic context beyond what the schema provides, so it meets the baseline of 3 for adequate but not enhanced parameter documentation.

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

Purpose4/5

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

The description clearly states the action ('Delete') and target resource ('an Elasticsearch index'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling deletion tools like 'delete_document' or 'delete_by_query', which would require specifying this operates at the index level versus document level.

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?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'delete_document', 'delete_by_query', and 'list_indices', there's no indication whether this should be used for bulk deletion, index management, or other contexts. No prerequisites or exclusions are mentioned.

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

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

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