Skip to main content
Glama
seohyunjun

OpenSearch MCP Server

by seohyunjun

list_index_patterns

Retrieve OpenSearch Dashboards index patterns to organize and access data across your OpenSearch cluster for efficient data management.

Instructions

List OpenSearch Dashboards index patterns2

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_index_patterns' tool. It searches the '.kibana' index for 'index-pattern' objects and returns a JSON list of their titles and IDs, or an error message.
    @mcp.tool(description="List OpenSearch Dashboards index patterns2") async def list_index_patterns() -> list[TextContent]: """ Find all index pattern IDs stored in the .kibana index. Especially useful for identifying the correct index pattern ID to use in the Discover view URL. This function queries the .kibana index for saved objects of type 'index-pattern' and returns a list of their titles and IDs. Returns: list[TextContent]: A list containing the found index patterns or an error message. """ self.logger.info("Searching for index patterns") try: response = self.es_client.search( index=".kibana", body={ '_source': ['index-pattern.title', '_id'], 'query': { 'term': { 'type': 'index-pattern' } } } ) patterns = json.dumps([{hit["_source"]["index-pattern"]["title"]: hit["_id"].replace('index-pattern:', '')} for hit in response["hits"]["hits"]], indent=4) return [TextContent(type="text", text=(patterns))] except Exception as e: self.logger.error(f"Error finding index patterns: {e}") return [TextContent(type="text", text=f"Error: {(e)}")]
  • Registration call for DashboardTools in the main server, which registers the list_index_patterns tool among others.
    dashboard_tools.register_tools(self.mcp)
  • Instantiation of DashboardTools class, prerequisite for registering its tools including list_index_patterns.
    dashboard_tools = DashboardTools(self.logger)

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