Skip to main content
Glama
seohyunjun

OpenSearch MCP Server

by seohyunjun

get_index_templates

Retrieve index template configurations from OpenSearch clusters to manage and analyze data structure settings.

Instructions

Get index template configurations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'get_index_templates' tool. It performs a GET request to '/_index_template' using the OpenSearch client, filters the response, and returns the templates as TextContent objects or an error message.
    @mcp.tool(description="Get index template configurations")
    async def get_index_templates() -> list[TextContent]:
        """
        Get index templates and their configurations.
        Returns template names and their configured number of shards.
        This helps understand how new indices will be created.
        """
        self.logger.info("Fetching index templates...")
        try:
            response = self.es_client.transport.perform_request(
                'GET',
                '/_index_template',
                params={'filter_path': ' _index_template?filter_path=index_templates.name,index_templates.index_template.index_patterns,index_templates.index_template.template.settings.index.number_of_shards'}
            )
            return [TextContent(type="text", text=str(response))]
        except Exception as e:
            self.logger.error(f"Error fetching index templates: {e}")
            return [TextContent(type="text", text=f"Error: {str(e)}")]
  • Calls register_tools on the AdminIndexTools instance, which defines and registers the 'get_index_templates' tool via decorators inside its register_tools method.
    admin_index_tools.register_tools(self.mcp)
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. It states 'Get' implying a read operation, but doesn't specify if it's safe, requires permissions, has rate limits, or what the return format looks like (e.g., JSON structure, pagination). This leaves significant gaps for a tool that likely interacts with a system like Elasticsearch.

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 with zero waste. It's front-loaded with the core action and resource, making it easy to parse. Every word earns its place without redundancy or fluff.

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?

Given the complexity of index templates in systems like Elasticsearch, the description is incomplete. With no annotations, no output schema, and minimal behavioral details, it lacks information on return values, error handling, or operational context. Siblings suggest this is part of a cluster management suite, but the description doesn't leverage that context.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't mention parameters, focusing on the tool's purpose. A baseline of 4 is given since no parameters exist, and the description doesn't add unnecessary details.

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 'Get index template configurations' clearly states the action (get) and resource (index template configurations). It distinguishes from siblings like 'get_mapping' or 'get_settings' by specifying the exact resource type. However, it doesn't specify scope (e.g., all templates vs specific ones) or format details, keeping it from a perfect score.

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. It doesn't mention prerequisites, context for usage, or comparisons to sibling tools like 'list_index_patterns' or 'list_indices'. The agent must infer usage from the name alone.

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/seohyunjun/opensearch-mcp-server'

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