Skip to main content
Glama
cr7258

Elasticsearch MCP Server

general_api_request

Execute custom HTTP requests to Elasticsearch/OpenSearch APIs not covered by specific tools, enabling flexible cluster interactions.

Instructions

Perform a general HTTP API request. Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.

        Args:
            method: HTTP method (GET, POST, PUT, DELETE, etc.)
            path: API endpoint path
            params: Query parameters
            body: Request body
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodYes
pathYes
paramsNo
bodyNo

Implementation Reference

  • The handler function for the MCP tool 'general_api_request'. It delegates the API request to the search client's general_api_request method.
    @mcp.tool()
    def general_api_request(method: str, path: str, params: Optional[Dict] = None, body: Optional[Dict] = None):
        """Perform a general HTTP API request.
           Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.
        
        Args:
            method: HTTP method (GET, POST, PUT, DELETE, etc.)
            path: API endpoint path
            params: Query parameters
            body: Request body
        """
        return self.search_client.general_api_request(method, path, params, body)
  • The registration of the 'general_api_request' tool occurs within the GeneralTools class's register_tools method using the @mcp.tool() decorator.
    def register_tools(self, mcp: FastMCP):
        @mcp.tool()
        def general_api_request(method: str, path: str, params: Optional[Dict] = None, body: Optional[Dict] = None):
            """Perform a general HTTP API request.
               Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.
            
            Args:
                method: HTTP method (GET, POST, PUT, DELETE, etc.)
                path: API endpoint path
                params: Query parameters
                body: Request body
            """
            return self.search_client.general_api_request(method, path, params, body)
  • Helper function in GeneralClient that implements the core logic by calling self.general_client.request.
    def general_api_request(self, method: str, path: str, params: Optional[Dict] = None, body: Optional[Dict] = None):
        """Perform a general HTTP API request.
           Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.
        """
        return self.general_client.request(method, path, params, body)
  • Risk configuration identifying 'general_api_request' as a high-risk operation for GeneralTools.
    "GeneralTools": {
        "general_api_request",
    },
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. It mentions it performs HTTP requests but doesn't disclose critical behavioral traits like authentication requirements, rate limits, error handling, response formats, or whether operations are read-only or destructive. For a general API tool with no annotations, this leaves significant gaps in understanding its behavior.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded: the first sentence states the core purpose, followed by usage guidance and parameter details. It avoids unnecessary fluff, though the parameter explanations are minimal and could be more structured for clarity.

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 tool's complexity (general API requests with 4 parameters), no annotations, no output schema, and 0% schema description coverage, the description is incomplete. It lacks details on authentication, error handling, response structure, and practical examples, making it inadequate for safe and effective use without additional context.

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 0%, so the description must compensate. It lists all 4 parameters with brief explanations (e.g., 'HTTP method', 'API endpoint path'), adding basic meaning beyond the schema's property names. However, it doesn't provide detailed semantics like format examples, constraints, or how params/body interact with the API, leaving room for ambiguity.

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 tool's purpose: 'Perform a general HTTP API request' and specifies it's for Elasticsearch/OpenSearch APIs without dedicated tools. It distinguishes from siblings by being a catch-all for APIs not covered by specific tools like create_index or search_documents, though it doesn't explicitly name all siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear usage context: 'Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.' This explicitly tells when to use it versus alternatives (the dedicated sibling tools), though it doesn't specify when NOT to use it or provide examples of edge cases.

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

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