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)

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