Skip to main content
Glama

search_index

Query Elasticsearch indices using natural language to retrieve specific data from your search clusters through the Model Context Protocol.

Instructions

Search an Elasticsearch index with a simple query string.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYes
queryYes

Implementation Reference

  • The handler function that implements the core logic of the 'search_index' tool, performing a search on the specified Elasticsearch index using the query string and returning the response or an error dictionary.
    def search_index(index: str, query: str) -> dict: """Search an Elasticsearch index with a simple query string.""" try: resp = es.search(index=index, query={"query_string": {"query": query}}) return resp except Exception as e: logger.error(f"Error searching index '{index}': {e}") return {"error": str(e)}
  • Input schema defined by type annotations: index (str), query (str); output: dict. Includes docstring describing the tool.
    def search_index(index: str, query: str) -> dict: """Search an Elasticsearch index with a simple query string."""
  • Registers the search_index function as an MCP tool using the FastMCP decorator.
    @mcp.tool()

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/Akhilvis/elastic-mcp'

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