general_api_request
Execute custom HTTP API requests (GET, POST, PUT, DELETE) to Elasticsearch/OpenSearch endpoints. Use when dedicated tools for specific APIs are unavailable.
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
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | ||
| method | Yes | ||
| params | No | ||
| path | Yes |
Implementation Reference
- src/tools/general.py:10-20 (handler)MCP tool handler for 'general_api_request', decorated with @mcp.tool(), delegates to search_client.general_api_requestdef 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)
- src/clients/common/general.py:6-10 (helper)Client-side helper implementation of general_api_request in GeneralClient, calls self.general_client.requestdef 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)
- src/server.py:43-54 (registration)GeneralTools is listed in tool_classes and registered via ToolsRegister.register_all_tools(tool_classes), which instantiates GeneralTools(search_client) and calls its register_tools method indirectly through with_exception_handling# Define all tool classes to register tool_classes = [ IndexTools, DocumentTools, ClusterTools, AliasTools, DataStreamTools, GeneralTools, ] # Register all tools register.register_all_tools(tool_classes)